April 5, 2008

It’s hard to leave behind the comfort of a system that you are very familiar with, especially when you think about the time you’ll spend pouring through manpages to do even the simplest thing in the new system. That was exactly the mental block that kept me from trying Git for so long. I’ve been learning to use it lately and I’ve become a complete convert. This all stemmed from my search for a simple web interface for Bazaar and my recent discovery of ikiwiki.

Git has GitWeb which turns out to be exactly what I had hoped to find for Bazaar: a simple CGI script with a powerful but minimalistic interface. There is BzrWeb, which is based on GitWeb, but it has stalled and is not compatible with recent versions of Bazaar. Loggerhead is currently the only option in the Bazaar world but it’s overkill for my needs, requiring Yet Another Web Development Framework (TurboGears in this case).

Git has many advantages, including several great features that it hadn’t previously occurred to me to start wanting in the first place:

Bazaar users may be interested in bzr2git, a simple shell script for moving data from Bazaar to Git. Unlike the method I outlined for migrating from RCS to Bazaar, bzr2git is able to accurately preserve the commit time, log messages, and other revision metadata. This is due to some of Git’s other nifty features like being able to set an arbitrary commit time via environment variables.

I did have to make a few modifications to to work with the current version of git in the Debian repositories (as well as some personalization). Here’s a diff:

< last_rev=`bzr version-info --custom --template='{revno}' $SOURCE`
> last_rev=`bzr version-info $SOURCE | grep revno | awk '{print $2}'`
> echo "LAST_REV $last_rev"
<   [ "$AUTHOR" = "rtomayko" ] && AUTHOR="Ryan Tomayko <rtomayko@gmail>"
>   [ "$AUTHOR" = "jrblevin" ] && AUTHOR="Jason Blevins <>"
< git gc --prune --aggressive
< echo "New git repo ready in $DEST"
\ No newline at end of file
> git gc --prune
> echo "New git repo ready in $DEST"

I’ve also incorporated some aspects of the ikiwiki philosophy into my website workflow. I’ve made the source code for the site available in two Git repositories, both of which can be browsed using GitWeb: blosxom.git and content.git. Better yet, I’ve added a post-update hook script that automatically updates the website whenever I push a commit to either repository.