- if(($ancestor || $branch) ne $last_branch) {
- print "Switching from $last_branch to $branch\n" if $opt_v;
- 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 {
- # 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 $?;
- }
- }