mirror of
https://github.com/git/git.git
synced 2024-05-10 14:16:07 +02:00
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>
This commit is contained in:
parent
3f2a7ae2c8
commit
6b6012e6ca
|
@ -87,6 +87,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -100,8 +101,10 @@
|
||||||
} 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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +124,11 @@
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue