Skip to content

Commit 48d044b

Browse files
Eric WongJunio C Hamano
authored andcommitted
git-svn: error out from dcommit on a parent-less commit
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ea865c commit 48d044b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

git-svn.perl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ sub dcommit {
589589
chomp(my @refs = safe_qx(qw/git-rev-list --no-merges/, "$gs..HEAD"));
590590
my $last_rev;
591591
foreach my $d (reverse @refs) {
592+
if (quiet_run('git-rev-parse','--verify',"$d~1") != 0) {
593+
die "Commit $d\n",
594+
"has no parent commit, and therefore ",
595+
"nothing to diff against.\n",
596+
"You should be working from a repository ",
597+
"originally created by git-svn\n";
598+
}
592599
unless (defined $last_rev) {
593600
(undef, $last_rev, undef) = cmt_metadata("$d~1");
594601
unless (defined $last_rev) {

0 commit comments

Comments
 (0)