From: Martin Langhoff Date: Tue, 16 Aug 2005 21:36:08 GMT Subject: Re: [PATCH] Add merge detection to git-cvsimport Message-ID: <46a038f9050816143646fa4137@mail.gmail.com> In-Reply-To: <20050816110725.GL11882MdfPADPa@garage.linux.student.kuleuven.ac.be> On 8/16/05, Sven Verdoolaege 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 = ); > > + 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