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

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

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Jun 24, 2006, 11:13 UTC
Message-ID
<11511475882820-git-send-email-martin@catalyst.net.nz>

Two bugs had slipped in the "keep one index per branch during import" patch. Both incremental imports and new branches would see an empty tree for their initial commit. Now we cover all the relevant cases, checking whether we actually need to setup the index before preparing the actual commit, and doing it.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
 git-cvsimport.perl |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
old mode 100644
new mode 100755
index d961b7b..1c1fd02
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -813,11 +813,26 @@ while(<CVS>) {
 			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 $?;
+			    }
+			}    
+		} else {
+			# just in case
+			unless ($index{$branch}) {
+			    $index{$branch} = tmpnam();
 			    $ENV{GIT_INDEX_FILE} = $index{$branch};
-		        }
+			    system("git-read-tree", $branch);
+			    die "read-tree failed: $?\n" if $?;
+			}
 		}
 		$last_branch = $branch if $branch ne $last_branch;
 		$state = 9;
-- 
1.4.1.rc1.g59c8
Next: Sergey Vlasov
Message 1 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.