chiark / gitweb /
git-debrebase: fix final diff check
[dgit.git] / git-debrebase
index ee98f09f9b121a5affb978c83314c4255a8859c0..f55ef4eb59721e1596922b918f637897345d4f2d 100755 (executable)
@@ -305,7 +305,7 @@ sub classify ($) {
        push @p, {
             Ix => $#p,
             CommitId => $ph,
-            Differs => (get_differs $t, $ph),
+            Differs => (get_differs $ph, $t),
         };
     }
 
@@ -475,7 +475,9 @@ sub walk ($;$$) {
        if ($nogenerate) {
            return (undef,undef);
        }
-       die "commit $cur: Cannot cope with this commit";
+       die "commit $cur: Cannot cope with this commit (d.".
+           (join ' ', map { sprintf "%#x", $_->{Differs} }
+            @{ $cl->{Parents} }). ")";
     };
 
     my $build;
@@ -513,7 +515,7 @@ sub walk ($;$$) {
        } elsif ($ty eq 'Mixed') {
            my $queue = sub {
                my ($q, $wh) = @_;
-               my $cls = { $cl, $xmsg->("split mixed commit: $wh part") };
+               my $cls = { %$cl, $xmsg->("split mixed commit: $wh part") };
                push @$q, $cls;
            };
            $queue->(\@brw_cl, "debian");
@@ -663,7 +665,7 @@ sub walk ($;$$) {
            $ch =~ s{^tree .*}{tree $newtree}m or confess "$ch ?";
            $ch =~ s{^parent .*\n}{}m;
            $ch =~ s{(?=^author)}{
-               map { "parent $_\n" } @parents
+               join '', map { "parent $_\n" } @parents
            }me or confess "$ch ?";
            if ($rewriting) {
                $ch =~ s{^committer .*$}{$committer_authline}m
@@ -682,7 +684,9 @@ sub walk ($;$$) {
        }
     };
 
-    runcmd @git, qw(diff-tree --quiet), $input, $build;
+    my $final_check = get_differs $build, $input;
+    die sprintf "internal error %#x", $final_check
+       if $final_check & ~D_PAT_ADD;
 
     return ($build, $breakwater);
 }