Skip to content

Commit 7b02b85

Browse files
Eric Wonggitster
authored andcommitted
git-svn: understand grafts when doing dcommit
Use the rev-list --parents functionality to read the parents of the commit. cat-file only shows the raw object with the original parents and doesn't take into account grafts; so we'll rely on rev-list machinery for the smarts here. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5701115 commit 7b02b85

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

git-svn.perl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,9 @@ sub working_head_info {
841841

842842
sub read_commit_parents {
843843
my ($parents, $c) = @_;
844-
my ($fh, $ctx) = command_output_pipe(qw/cat-file commit/, $c);
845-
while (<$fh>) {
846-
chomp;
847-
last if '';
848-
/^parent ($sha1)/ or next;
849-
push @{$parents->{$c}}, $1;
850-
}
851-
close $fh; # break the pipe
844+
chomp(my $p = command_oneline(qw/rev-list --parents -1/, $c));
845+
$p =~ s/^($c)\s*// or die "rev-list --parents -1 $c failed!\n";
846+
@{$parents->{$c}} = split(/ /, $p);
852847
}
853848

854849
sub linearize_history {

0 commit comments

Comments
 (0)