Fun with Git

Wall climber

I've been posting a lot of grey photographs lately, so here's something with some color. I'm not sure what variety of ornamental climbing vine this is, although I suspect something related to Boston Ivy is more likely than true ivy.

Mission accomplished again for today: I read some, wrote a review, and crossed two things off my to-do list (and did a software release that wasn't on my to-do list at all). I even went for an extra walk.

Much of the productive part of today was spent fixing the Debian packaging repository for OpenAFS. This started out as a CVS repository, was converted to Subversion, used svk for a while, and now is a Git repository. In its days as a Subversion repository, we checked each upstream tarball release directly into the repository, as well as maintaining a vendor branch of the contents of it, so that one could build the Debian packages directly from a checkout of the repository. Now, with Git and pristine-tar, this isn't necessary and means the repository takes up tons of space and takes forever to clone over small links.

Git has a tool for rewriting repositories, git filter-branch. This was the first time that I used it, but it works surprisingly well. I wrote a little shell script that moves the tarballs out of the repository and, if the source in the repository was in an openafs subdirectory, moves it all up one level and deletes the subdirectory. Then I ran that as a tree filter, used cat as the tag-name filter, and added a mini Perl script to remove the git-svn-url bits from the commit messages that I'd mistakenly added when I initially converted the repository. I applied that to all revisions, let it run for a while, and it worked like a charm. I then committed the tarballs with pristine-tar, using the relevant upstream tag as reference, and cloned the new repository to a fresh one.

It reduced the size of the repository from over 300MB to under 40MB. Totally worth it for an afternoon of work, and now I know a lot more about manipulating Git repositories.

Posted: 2009-12-30 00:29 — Why no comments?

Last spun 2013-07-01 from thread modified 2013-01-04