Part of the problem is that there is not 'git library' last I checked. Git started out as a loosely strung-together set of commands that vary from compiled C-code to Perl scripts to plain shell scripts. Over time the bottlenecks have been ironed out and ported to C and such, but git is under heavy development even now. Just follow the git mailing list for a while to see.
Also do some searching for stuff about JGit which is a git implementation in Java. Last I heard they were having a lot of trouble getting the performance to match the actual git tools because most of the bottlenecks had been fixed in the 'official' tools using highly optimized C-code.
{edit} I guess I should add that the JGit stuff is information I read somewhere, but I don't recall if it was in a blog post/comment/mailing list email/etc.