Implement ShortenOids

Add some code to shorten oids. We could do that in pure go in the longrun (should be faster), but for now we just call what libgit2 gives us.

I'm not sure if libgit2 does some clever tricks that permits calculating this without keeping every oid in memory, which might make this code scale worse than pure libgit, but for now it's okay I guess.