summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-01-06 02:22:05 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-01-06 02:22:06 +0000
commit8b74ec543cd65112bd83f57dad5c7dcffb592224 (patch)
treea13297214c869e61524f0f5618e3e31104f7741e /dgit
parentef9fb96766ba8b8eaba540a760efa4db4b1bb5da (diff)
dgit: When source discrepancy involves mode changes, report them specially.
Closes:#886442. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit30
1 files changed, 29 insertions, 1 deletions
diff --git a/dgit b/dgit
index aa8f771..2e51f76 100755
--- 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