git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SVSven Verdoolaege <skimo@kotnet.org>
Date
Aug 16, 2005, 11:07 UTC
Message-ID
<20050816110725.GL11882MdfPADPa@garage.linux.student.kuleuven.ac.be>
In-Reply-To
<20050816103527.F420A33010C@ng.eduforge.org>
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...

Show 9 quoted lines
> +    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
Previous: Martin LanghoffNext: Martin Langhoff
Message 2 of 4 in “Add merge detection to git-cvsimport”
  1. Add merge detection to git-cvsimportMartin Langhoff, Aug 16, 2005
  2. Sven VerdoolaegeAug 16, 2005
  3. Martin LanghoffAug 16, 2005
  4. Matthias UrlichsAug 17, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.