Geoff Garside

Jul 05 2008

Learning how Git works

Since switching to git I’ve found the lack of a library slightly annoying for a couple of reasons. While I never wanted to use the Subversion library it was nice knowing it was around and the Ruby bindings certainly made some apps possible. Git though doesn’t have a library or Ruby bindings. Instead its a veritable hodge-podge of programs which when combined together make up git proper. This makes things harder on people who want to have another program use git as they’ve got to jump through the hoops of parsing STDOUT data to work out what git is doing. This is far from optimal.

Now there is a “libification” project which is working seemingly sporadically to create some nice libs for git. Though apparently the git source itself needs to be doused in Cilit Bang and thoroughly cleaned for a lot of the libification project to really take off.

But all that aside, and I’ve been searching for something to fill the void of my social life, I’ve started working on learning how git works. Mainly by writing code to inspect the various objects in git. As I also wanted to polish up my Cocoa skills I’ve been doing it in that. Rather recursively the project is being tracked with git which means I’ve got a healthy supply of git objects to through at my inspection code.

As I’m going I’m also moving successful inspection code into classes to represent the various git objects so I can just throw the data at one of those classes and then get the nice information back.

It’s also been quite nice learning how to work with zlib and openssl with Cocoa as I’ve not had any call to do either before. But sha1 hashing is quite a substantial part of git. Also all the object files are zlib compressed so adding routines to NSData to do decompression and compression has also been a learning experience.

I feel like I’ve been making good use of my spare time with this and have to say version control from a file system perspective definitely makes sense, git certainly does a lot to prevent itself from having to store multiple instances of the same file data and its sometimes surprising how many times you’ll end up with the same file data or folder structure in multiple places within a project. Of course this also helps across versions as you tend to commit little and often.

Comments
blog comments powered by Disqus