Skip to content

Commit bfc07db

Browse files
committed
Merge branch 'bk/maint-cvsexportcommit' into maint
* bk/maint-cvsexportcommit: cvsexportcommit: fix for commits that do not have parents
2 parents 9e54dc6 + 6b6012e commit bfc07db

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

git-cvsexportcommit.perl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
}
8888
}
8989

90+
my $noparent = "0000000000000000000000000000000000000000";
9091
if ($parent) {
9192
my $found;
9293
# double check that it's a valid parent
@@ -100,8 +101,10 @@
100101
} else { # we don't have a parent from the cmdline...
101102
if (@parents == 1) { # it's safe to get it from the commit
102103
$parent = $parents[0];
103-
} else { # or perhaps not!
104-
die "This commit has more than one parent -- please name the parent you want to use explicitly";
104+
} elsif (@parents == 0) { # there is no parent
105+
$parent = $noparent;
106+
} else { # cannot choose automatically from multiple parents
107+
die "This commit has more than one parent -- please name the parent you want to use explicitly";
105108
}
106109
}
107110

@@ -121,7 +124,11 @@
121124
}
122125
close MSG;
123126

124-
`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
127+
if ($parent eq $noparent) {
128+
`git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
129+
} else {
130+
`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
131+
}
125132

126133
## apply non-binary changes
127134

0 commit comments

Comments
 (0)