chiark / gitweb /
dgit: When source discrepancy involves mode changes, report them specially.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Jan 2018 02:22:05 +0000 (02:22 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Jan 2018 02:22:06 +0000 (02:22 +0000)
Closes:#886442.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index aa98a41a01c1d503031454c4d60f2ad31986462a..591ee6779baae62402b72502acab8ad0d696183f 100644 (file)
@@ -10,6 +10,8 @@ dgit (4.2~) experimental; urgency=medium
     Sean Whitton]  Closes:#856402.
 
   Minor fixes:
+  * When source discrepancy involves file mode changes, report them
+    specially.  Closes:#886442.
   * In split brain mode, with unexpected diffs, print dgit view
     commitid in suggested diff rune.  (HEAD is wrong.)  Closes:#886443.
   * Fix message about missing quilt cache entry to refer to
diff --git a/dgit b/dgit
index aa8f7717248023e2fc86029b206fc0050109010d..2e51f76cdc439354a0622fa28313b931f6e88942 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4240,7 +4240,35 @@ END
        if ($r==256) {
            my $referent = $split_brain ? $dgithead : 'HEAD';
            my $diffs = cmdoutput @git, qw(diff --stat), $tree, $dgithead;
-           fail <<END
+
+           my @mode_changes;
+           my $raw = cmdoutput @git,
+               qw(diff --no-renames -z -r --raw), $tree, $dgithead;
+           my $changed;
+           foreach (split /\0/, $raw) {
+               if (defined $changed) {
+                   push @mode_changes, "$changed: $_\n" if $changed;
+                   $changed = undef;
+                   next;
+               } elsif (m/^:0+ 0+ /) {
+                   $changed = '';
+               } elsif (m/^:(?:10*)?(\d+) (?:10*)?(\d+) /) {
+                   $changed = "Mode change from $1 to $2"
+               } else {
+                   die "$_ ?";
+               }
+           }
+           if (@mode_changes) {
+               fail <<END.(join '', @mode_changes).<<END;
+HEAD specifies a different tree to $dscfn:
+$diffs
+END
+There is a problem with your source tree (see dgit(7) for some hints).
+To see a full diff, run git diff $tree $referent
+END
+           }
+
+           fail <<END;
 HEAD specifies a different tree to $dscfn:
 $diffs
 Perhaps you forgot to build.  Or perhaps there is a problem with your