aboutsummaryrefslogtreecommitdiff
path: root/git-cvsexportcommit.perl
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-10-31 16:55:13 -0400
committerJunio C Hamano <gitster@pobox.com>2007-10-31 23:51:13 -0700
commit6b6012e6ca628a00d2e0fa6f686017f9e2d66203 (patch)
treeb3c8b6e527e2f3d067099d79992f610c9fc58d75 /git-cvsexportcommit.perl
parent3f2a7ae2c84c921e11041a5edc2522964fc1cce5 (diff)
downloadgit-6b6012e6ca628a00d2e0fa6f686017f9e2d66203.tar.gz
git-6b6012e6ca628a00d2e0fa6f686017f9e2d66203.tar.xz
cvsexportcommit: fix for commits that do not have parents
Previously commits without parents would fail to export with a message indicating that the commits had more than one parent. Instead we should use the --root option for git-diff-tree in place of a parent. Signed-off-by: Brad King <brad.king@kitware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsexportcommit.perl')
-rwxr-xr-xgit-cvsexportcommit.perl13
1 files changed, 10 insertions, 3 deletions
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 7b19a33ad..b2c9f98e8 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -87,6 +87,7 @@ foreach my $line (@commit) {
}
}
+my $noparent = "0000000000000000000000000000000000000000";
if ($parent) {
my $found;
# double check that it's a valid parent
@@ -100,8 +101,10 @@ if ($parent) {
} else { # we don't have a parent from the cmdline...
if (@parents == 1) { # it's safe to get it from the commit
$parent = $parents[0];
- } else { # or perhaps not!
- die "This commit has more than one parent -- please name the parent you want to use explicitly";
+ } elsif (@parents == 0) { # there is no parent
+ $parent = $noparent;
+ } else { # cannot choose automatically from multiple parents
+ die "This commit has more than one parent -- please name the parent you want to use explicitly";
}
}
@@ -121,7 +124,11 @@ if ($opt_a) {
}
close MSG;
-`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
+if ($parent eq $noparent) {
+ `git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
+} else {
+ `git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
+}
## apply non-binary changes