chiark / gitweb /
dgit: HEAD/.dsc mismatch error: Much better message
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Oct 2016 23:54:19 +0000 (00:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Oct 2016 23:40:08 +0000 (00:40 +0100)
Closes:#809516.

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

index 9c52188cec5d677c55e4aa31f4d3c3f0a3e9140f..0dda1c7e022f46b5eefbf6398f3c98ce02a44cb4 100644 (file)
@@ -49,6 +49,8 @@ dgit (1.5~~) unstable; urgency=medium
     Closes:#833025.
   * Better error message if HEAD contains changes unrepresentable
     by `3.0 (quilt)'.  Closes:#834618.
+  * Much better error message when HEAD and .dsc do not match.
+    Closes:#809516.
 
   Infrastructure:
   * Better error handling in dgit-repos-policy-debian.
diff --git a/dgit b/dgit
index 7b16ff3fa31cc5bf1a7b30df1cbdd9b03419236c..469f6bfe5572ad718439eb8024719d1d0a325bcb 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3211,17 +3211,20 @@ END
     my ($tree,$dir) = mktree_in_ud_from_only_subdir();
     check_for_vendor_patches() if madformat($dsc->{format});
     changedir '../../../..';
-    my $diffopt = $debuglevel>0 ? '--exit-code' : '--quiet';
-    my @diffcmd = (@git, qw(diff), $diffopt, $tree, $dgithead);
+    my @diffcmd = (@git, qw(diff --quiet), $tree, $dgithead);
     debugcmd "+",@diffcmd;
     $!=0; $?=-1;
     my $r = system @diffcmd;
     if ($r) {
        if ($r==256) {
-           fail "$dscfn specifies a different tree to your HEAD commit;".
-               " perhaps you forgot to build".
-               ($diffopt eq '--exit-code' ? "" :
-                " (run with -D to see full diff output)");
+           my $diffs = cmdoutput @git, qw(diff --stat), $tree, $dgithead;
+           fail <<END
+HEAD specifies a different tree to $dscfn:
+$diffs
+Perhaps you forgot to build.  Or perhaps there is a problem with your
+ source tree (see dgit(7) for some hints).  To see a full diff, run
+   git diff $tree HEAD
+END
        } else {
            failedcmd @diffcmd;
        }
index 23083a7667d4144d6b271de106cf86149d38dd52..fe68222c149d74fc42a7fa973870249eb2352687 100755 (executable)
@@ -27,7 +27,7 @@ t-dgit --quilt=gbp --clean=git --gbp-pq=no-such-command-gbp build-source
 
 t-dgit --quilt=gbp --clean=git build-source
 
-t-expect-fail 'specifies a different tree to your HEAD commit' \
+t-expect-fail "HEAD specifies a different tree to $p" \
   t-dgit push
 
 test-push () {