Archive

Archive for the ‘Code4Lib’ Category

Git repo law #1: save the time of the puller

March 29th, 2010 Galen Charlton No comments

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.

Categories: Code4Lib, Miscellany Tags:

What is truth?

September 14th, 2009 Galen Charlton 2 comments

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.

Categories: Code4Lib, Perl Tags:

Code4Lib 2008 lightning talk – Git and distributed cataloging

March 5th, 2008 Galen Charlton No comments

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.

Categories: Code4Lib Tags: