Skip to content

Commit

Permalink
git-svn: error out from dcommit on a parent-less commit
Browse files Browse the repository at this point in the history
dcommit would unconditionally append "~1" to a commit in order
to generate a diff.  Now we generate a meaningful error message
if we try to generate an impossible diff.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Nov 23, 2006
1 parent 0ea865c commit 48d044b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,13 @@ sub dcommit {
chomp(my @refs = safe_qx(qw/git-rev-list --no-merges/, "$gs..HEAD"));
my $last_rev;
foreach my $d (reverse @refs) {
if (quiet_run('git-rev-parse','--verify',"$d~1") != 0) {
die "Commit $d\n",
"has no parent commit, and therefore ",
"nothing to diff against.\n",
"You should be working from a repository ",
"originally created by git-svn\n";
}
unless (defined $last_rev) {
(undef, $last_rev, undef) = cmt_metadata("$d~1");
unless (defined $last_rev) {
Expand Down

0 comments on commit 48d044b

Please sign in to comment.