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