1
0
mirror of https://github.com/git/git.git synced 2024-11-20 12:34:05 +01:00

Use git-for-each-ref to check whether the origin branch exists.

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>
This commit is contained in:
Stephan Springl 2007-05-23 12:13:21 +01:00 committed by Junio C Hamano
parent c80e07d495
commit 7ca055f75a

@ -559,11 +559,6 @@ unless (-d $git_dir) {
$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>);
@ -588,6 +583,11 @@ unless (-d $git_dir) {
$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