summaryrefslogtreecommitdiff
path: root/git-cvsexportcommit.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-01 15:39:59 -0700
committerJunio C Hamano <gitster@pobox.com>2007-11-01 15:39:59 -0700
commit5fb19486e6f4b6d31f33f5a1eab970b244fa2d08 (patch)
treee2695ed254a728d148271529e255b37b2d73a75d /git-cvsexportcommit.perl
parentf31dfa604c83fd998f7b57942a7bac4defc8c435 (diff)
parent6b6012e6ca628a00d2e0fa6f686017f9e2d66203 (diff)
downloadgit-5fb19486e6f4b6d31f33f5a1eab970b244fa2d08.tar.gz
Merge branch 'bk/maint-cvsexportcommit'
* bk/maint-cvsexportcommit: cvsexportcommit: fix for commits that do not have parents
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 f284c88a46..26844af439 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -82,6 +82,7 @@ foreach my $line (@commit) {
}
}
+my $noparent = "0000000000000000000000000000000000000000";
if ($parent) {
my $found;
# double check that it's a valid parent
@@ -95,8 +96,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";
}
}
@@ -116,7 +119,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