diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-11-23 14:54:03 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-11-23 15:17:43 -0800 |
commit | 48d044b5fe7ae553f05186db46b5cb4708afceb4 (patch) | |
tree | dc62f430e87224eab90095aad3de0de546a5bea5 /git-svn.perl | |
parent | 0ea865ce7af4b2b6ee85dc52b5fad84260e27871 (diff) | |
download | git-48d044b5fe7ae553f05186db46b5cb4708afceb4.tar.gz git-48d044b5fe7ae553f05186db46b5cb4708afceb4.tar.xz |
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 <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-x | git-svn.perl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl index 80b7b87f0..f0db4af58 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -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) { |