chiark / gitweb /
test suite: gdr-diverge-nmu-dgit: Tolerate gdr-generated patches
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 1f1b0f59b432484f63c823b8345ab42493a3ba26..3438f62f2b69a56d30fb5533bfc4cd25e583b6c2 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -289,6 +289,14 @@ sub bpd_abs () {
     return $r;
 }
 
+sub get_tree_of_commit ($) {
+    my ($commitish) = @_;
+    my $cdata = cmdoutput @git, qw(cat-file commit), $commitish;
+    $cdata =~ m/\n\n/;  $cdata = $`;
+    $cdata =~ m/^tree (\w+)$/m or confess "cdata $cdata ?";
+    return $1;
+}
+
 sub branch_gdr_info ($$) {
     my ($symref, $head) = @_;
     my ($status, $msg, $current, $ffq_prev, $gdrlast) =
@@ -3164,10 +3172,7 @@ END
        # here we go, then:
        my $tree_commit = $mergeinputs[0]{Commit};
 
-       my $tree = cmdoutput @git, qw(cat-file commit), $tree_commit;
-       $tree =~ m/\n\n/;  $tree = $`;
-       $tree =~ m/^tree (\w+)$/m or die "$dsc_hash tree ?";
-       $tree = $1;
+       my $tree = get_tree_of_commit $tree_commit;;
 
        # We use the changelog author of the package in question the
        # author of this pseudo-merge.  This is (roughly) correct if
@@ -4235,6 +4240,15 @@ END
     my $actualhead = git_rev_parse('HEAD');
 
     if (branch_is_gdr_unstitched_ff($symref, $actualhead, $archive_hash)) {
+       if (quiltmode_splitbrain()) {
+           my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $actualhead);
+           fail <<END;
+Branch is managed by git-debrebase ($ffq_prev
+exists), but quilt mode ($quilt_mode) implies a split view.
+Pass the right --quilt option or adjust your git config.
+Or, maybe, run git-debrebase forget-was-ever-debrebase.
+END
+       }
        runcmd_ordryrun_local @git_debrebase, 'stitch';
        $actualhead = git_rev_parse('HEAD');
     }
@@ -5372,7 +5386,7 @@ sub quiltify ($$$$) {
                print STDERR "$us:  ", $reportnot->($notp), "\n";
                $all_gdr &&= $notp->{Child} &&
                    (git_cat_file $notp->{Child}{Commit}, 'commit')
-                   =~ m{^\[git-debrebase.*\]$}m;
+                   =~ m{^\[git-debrebase(?! split[: ]).*\]$}m;
            }
            print STDERR "\n";
            $failsuggestion =