提交 59b0c24d 编写于 作者: M Matthieu Moy 提交者: Junio C Hamano

git-svn: detect and fail gracefully when dcommitting to a void

The command

  git svn clone (URL of an empty SVN repo here)

works, creates an empty git repository. I can perform the initial
commit there, but then, "git svn dcommit" says :

Use of uninitialized value in concatenation (.) or string at .../git-svn line 414.
Committing to  ...
Unable to determine upstream SVN information from HEAD history

I guess a correct management of the initial commit in git-svn would be
hard to implement, but at least, the error message can be improved.
First step is something like the patch below, and better would be for
"git svn clone" to warn that it won't be able to do much with the
cloned repo.
Acked-by: NEric Wong <normalperson@yhbt.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c8af1de9
......@@ -264,6 +264,9 @@ int setup_diff_no_index(struct rev_info *revs,
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
break;
}
if (nongit && argc != i + 2)
die("git diff [--no-index] takes two paths");
if (argc != i + 2 || (!is_outside_repo(argv[i + 1], nongit, prefix) &&
!is_outside_repo(argv[i], nongit, prefix)))
return -1;
......
......@@ -410,10 +410,12 @@ sub cmd_dcommit {
$head ||= 'HEAD';
my @refs;
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
print "Committing to $url ...\n";
if ($url) {
print "Committing to $url ...\n";
}
unless ($gs) {
die "Unable to determine upstream SVN information from ",
"$head history\n";
"$head history.\nPerhaps the repository is empty.";
}
my $last_rev;
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册