Skip to content

Commit

Permalink
Use git-for-each-ref to check whether the origin branch exists.
Browse files Browse the repository at this point in the history
This works in repositories that have their refs packed by
"git-pack-refs --all --prune" whereas testing the file
$git_dir/refs/heads/$opt_o does not.

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Stephan Springl authored and Junio C Hamano committed May 23, 2007
1 parent c80e07d commit 7ca055f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,6 @@ ($$)
$last_branch = $opt_o;
$orig_branch = "";
} else {
-f "$git_dir/refs/heads/$opt_o"
or die "Branch '$opt_o' does not exist.\n".
"Either use the correct '-o branch' option,\n".
"or import to a new repository.\n";

open(F, "git-symbolic-ref HEAD |") or
die "Cannot run git-symbolic-ref: $!\n";
chomp ($last_branch = <F>);
Expand All @@ -588,6 +583,11 @@ ($$)
$branch_date{$head} = $1;
}
close(H);
if (!exists $branch_date{$opt_o}) {
die "Branch '$opt_o' does not exist.\n".
"Either use the correct '-o branch' option,\n".
"or import to a new repository.\n";
}
}

-d $git_dir
Expand Down

0 comments on commit 7ca055f

Please sign in to comment.