Subject: Re: [PATCH] Add merge detection to git-cvsimport

From: Martin Langhoff <[email-masked]>
Date: Wed, 17 Aug 2005 09:36:08 +1200

On 8/16/05, Sven Verdoolaege <[email-masked]> wrote:
> 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...

We are reading/writing directly to .git/refs/heads/ a lot in this
script. Not changing that for the time being.

> > +    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 ?

Because we get the head names from cvsps output, and we want to have a
specific error when cvsps has given us a bogus branch name.
git-commit-tree could fail for a number of reasons, this one is the
most likely one to be from a bug in cvsps or the cvsimport logic.
 
> > +                             if ($mparent eq 'HEAD') { $mparent = 'origin'};
> 
> Please don't hardcode 'origin' here.

Duh! Patch submitted. Juniooooo! 

martin