Merge branch 'bk/maint-cvsexportcommit'

* bk/maint-cvsexportcommit:
  cvsexportcommit: fix for commits that do not have parents
This commit is contained in:
Junio C Hamano
2007-11-01 15:39:59 -07:00

View File

@@ -82,6 +82,7 @@ foreach my $line (@commit) {
} }
} }
my $noparent = "0000000000000000000000000000000000000000";
if ($parent) { if ($parent) {
my $found; my $found;
# double check that it's a valid parent # double check that it's a valid parent
@@ -95,8 +96,10 @@ if ($parent) {
} else { # we don't have a parent from the cmdline... } else { # we don't have a parent from the cmdline...
if (@parents == 1) { # it's safe to get it from the commit if (@parents == 1) { # it's safe to get it from the commit
$parent = $parents[0]; $parent = $parents[0];
} else { # or perhaps not! } elsif (@parents == 0) { # there is no parent
die "This commit has more than one parent -- please name the parent you want to use explicitly"; $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; 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 ## apply non-binary changes