On Tue, Aug 16, 2005 at 10:35:27PM +1200, Martin Langhoff wrote: > + > +sub get_headref($$) {
If you want to check whether a ref is valid, then it is better to use git-rev-parse... > + my $name = shift; > + my $git_dir = shift; > + my $sha; > + > + if (open(C,"$git_dir/refs/heads/$name")) { > + chomp($sha = <C>); > + close(C); > + length($sha) == 40 > + or die "Cannot get head id for $name ($sha): $!\n"; ... but if you're just going to die, then why not simply let git-commit-tree do the test ? > + if ($mparent eq 'HEAD') { $mparent = 'origin'}; Please don't hardcode 'origin' here. skimo - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html