summaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorStephan Springl <springl-git@bfw-online.de>2007-05-23 11:13:21 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-23 18:06:38 (GMT)
commit7ca055f75ad7ffd2251d4b607fbb86d7bcfd77c7 (patch)
tree396a03b46cefebb8a9a1425468877bbaeedd1a92 /git-cvsimport.perl
parentc80e07d4959591f5addcd48c7d42017b40c25f36 (diff)
downloadgit-7ca055f75ad7ffd2251d4b607fbb86d7bcfd77c7.zip
git-7ca055f75ad7ffd2251d4b607fbb86d7bcfd77c7.tar.gz
git-7ca055f75ad7ffd2251d4b607fbb86d7bcfd77c7.tar.bz2
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>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl10
1 files changed, 5 insertions, 5 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ac74bc5..f68afe7 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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