Liz Rea of the North East Kansas Library System and I have started a new group blog, Library Hackers Unite!. It’s a blog by and for library sysadmins and programmers with a practical bent, and we aim to cover the gamut of library systems hackerdom.

Besides Liz and myself, Joe Atzberger and Ruth Bavousett write there as well. Want to join the crew or do a guest post? Drop Liz or me a line.

Ollie LOLcat
Ollie LOLcat by mlcastle

Apologies to Ranganathan.

Say you have a Git repository you want to publish, and you’ve set up a Gitweb for it at http://git.example.com/?p=myrepo.git;a=summary.  So far, so good: others can browse your commits and download packages and tarballs.  Suppose you’ve also configured git-daemon(1) to publish the repo using the Git protocol.  Great!  Now suppose you’ve told the world to go to http://git.example.com. The world looks at what you have wrought, and then asks: How can we clone your repository?

Even assuming that you’ve used the default options in your git-daemon configuration, the Git clone URL could be any of the following depending on where your OS distribution’s packagers decided to put things:

  • git://git.example.com/myrepo
  • git://git.example.com/myrepo.git
  • git://git.example.com/git/myrepo
  • git:/git.example.com/git/myrepo.git
  • and there are even more possibilities if you did tweak the config

The rub is that Gitweb doesn’t know and can’t know until you tell it.  If you don’t tell it, somebody who wants to clone your repo and who is looking at the Gitweb page can only guess.  If they guess wrong a few times, they may give up.

Fortunately, the solution is easy: to make the Git clone URL display in your Gitweb, go to the repository’s base directory and create a new file called cloneurl and enter the correct clone URL(s), one per line. While you’re at it, make sure that the description file is accurate as well.

Not paying close attention to Perl’s definition of truth can sometimes lead to subtle bugs. Consider a simple scalar $x that should contain a string exactly one character wide. If the original value of $x can be undefined and you want to make sure it has a default value of a single space, do not do the following:

$x ||= ' ';

Why not? If $x starts off as ‘0’, a permitted value, this line will change it to ' '. Instead, do this

$x = ' ' unless defined $x;

Remember, 0, '0', '', and undef all evaluate to Perl’s notion of false.

Last  Wednesday I gave a lightning talk at Code4LibCon on some musings about Git qua distributed version control system and ideas for distributed cataloging. Check out my slides.

Slides from the other lightning talks are being posted here. Be sure to check out Andy Mullen’s presentation when his slides and the video are posted — making player piano MIDI files from OCRs of scanned scores is special enough, but his sense of dramatic timing during his presentation was marvelous.