If you return CAutoRepository, call constructor twice?
keep an git_repository instance for the whole runtime : Do you want to mimic the old style for libgit?
cache : not sure
ensure that no concurrent access : It is difficult. Currently there are potential concurrent access to libgit2, causing crash because libgit2 is not threadsafe.