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>
Eric Wong committed
Sep 8, 2007 at 16:33 UTC
7b02b85a66fee6b357e02f9e70dd0baa0fd24308
1 file changed
+3
-8
git-svn.perl
+3
-8
@@ -841,14 +841,9 @@ sub working_head_info {
841
842
sub read_commit_parents {
843
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);
847
}
848
849
sub linearize_history {