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>
This commit is contained in:
Johannes Schindelin
2006-06-24 21:42:20 +02:00
committed by Junio C Hamano
parent 7ccd9009ac
commit 061303f0b5

View File

@ -470,6 +470,9 @@ my %index; # holds filenames of one index per branch
$index{$opt_o} = tmpnam(); $index{$opt_o} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$opt_o}; $ENV{GIT_INDEX_FILE} = $index{$opt_o};
system("git-read-tree", $opt_o);
die "read-tree failed: $?\n" if $?;
unless(-d $git_dir) { unless(-d $git_dir) {
system("git-init-db"); system("git-init-db");
die "Cannot init the GIT db at $git_tree: $?\n" if $?; die "Cannot init the GIT db at $git_tree: $?\n" if $?;
@ -810,20 +813,18 @@ while(<CVS>) {
} }
if(($ancestor || $branch) ne $last_branch) { if(($ancestor || $branch) ne $last_branch) {
print "Switching from $last_branch to $branch\n" if $opt_v; print "Switching from $last_branch to $branch\n" if $opt_v;
unless ($index{$branch}) {
$index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch};
}
if ($ancestor) {
system("git-read-tree", $ancestor);
die "read-tree failed: $?\n" if $?;
} else {
unless ($index{$branch}) { unless ($index{$branch}) {
$index{$branch} = tmpnam(); $index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch}; $ENV{GIT_INDEX_FILE} = $index{$branch};
system("git-read-tree", $branch); system("git-read-tree", $branch);
die "read-tree failed: $?\n" if $?; 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 { } else {
# just in case # just in case