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

Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 24, 2006, 19:42 UTC
Message-ID
<Pine.LNX.4.63.0606242111250.29667@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<11511475882820-git-send-email-martin@catalyst.net.nz>
Hi,
almost happy.
On Sat, 24 Jun 2006, Martin Langhoff wrote:
Show 16 quoted lines
>  			unless ($index{$branch}) {
>  			    $index{$branch} = tmpnam();
>  			    $ENV{GIT_INDEX_FILE} = $index{$branch};
> -			    system("git-read-tree", $branch);
> +			}
> +			if ($ancestor) {
> +			    system("git-read-tree", $ancestor);
>  			    die "read-tree failed: $?\n" if $?;
>  			} else {
> +			    unless ($index{$branch}) {
> +				$index{$branch} = tmpnam();
> +				$ENV{GIT_INDEX_FILE} = $index{$branch};
> +				system("git-read-tree", $branch);
> +				die "read-tree failed: $?\n" if $?;
> +			    }
> +			}    
This line ^ seems to have white space at the end.

Also, in my case, this is still broken. $index{$branch} is set, $ancestor not, but $ENV{GIT_INDEX_FILE} ne $index{$branch}.

You can reproduce this by importing into branch origin while branch master (which is not equal to origin) is checked out.

Plus, the initial setting of GIT_INDEX_FILE forgot to perform a git-read-tree.

How about this on top of your patch (which fixes things with my setup):

--- [PATCH] cvsimport: always set $ENV{GIT_INDEX_FILE} to $index{$branch}

Also, make sure that the initial git-read-tree is performed.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git-cvsimport |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

--- git-cvsimport.perl 2006-06-24 20:30:33.000000000 +0200 +++ git-cvsimport 2006-06-24 21:35:42.000000000 +0200

@@ -470,6 +470,9 @@
 $index{$opt_o} = tmpnam();
 
 $ENV{GIT_INDEX_FILE} = $index{$opt_o};
+system("git-read-tree", $opt_o);
+die "read-tree failed: $?\n" if $?;
+
 unless(-d $git_dir) {
 	system("git-init-db");
 	die "Cannot init the GIT db at $git_tree: $?\n" if $?;
@@ -813,17 +816,15 @@
 			unless ($index{$branch}) {
 			    $index{$branch} = tmpnam();
 			    $ENV{GIT_INDEX_FILE} = $index{$branch};
+			    system("git-read-tree", $branch);
+			    die "read-tree failed: $?\n" if $?;
 			}
+			# just in case
+			$ENV{GIT_INDEX_FILE} = $index{$branch};
 			if ($ancestor) {
+			    print "have ancestor $ancestor" if $opt_v;
 			    system("git-read-tree", $ancestor);
 			    die "read-tree failed: $?\n" if $?;
-			} else {
-			    unless ($index{$branch}) {
-				$index{$branch} = tmpnam();
-				$ENV{GIT_INDEX_FILE} = $index{$branch};
-				system("git-read-tree", $branch);
-				die "read-tree failed: $?\n" if $?;
-			    }
 			}
 		} else {
 			# just in case
Previous: Sergey VlasovNext: Junio C Hamano
Message 3 of 7 in “cvsimport: setup indexes correctly for ancestors and incremental imports”
  1. cvsimport: setup indexes correctly for ancestors and incremental importsMartin Langhoff, Jun 24, 2006
  2. Sergey VlasovJun 24, 2006
  3. Johannes SchindelinJun 24, 2006
  4. Junio C HamanoJun 25, 2006
  5. Petr BaudisJun 25, 2006
  6. Junio C HamanoJun 25, 2006
  7. Johannes SchindelinJun 25, 2006

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.