chiark / gitweb /
dgit: Improve message for discrepant quilt fixup
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 20 Jun 2018 23:34:03 +0000 (00:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 21 Jun 2018 00:11:11 +0000 (01:11 +0100)
When quilt fixup fails because of discrepancies, print a git diff rune
which will show them.  Closes:#865446.

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

index da734308991faeb1d88c6c594a858616e306170f..3216e4aada2ecd61ce2ae4c29a22d1d7b44b8354 100644 (file)
@@ -8,6 +8,8 @@ dgit (5.2~) unstable; urgency=medium
   * When build fails because the network is offline, mention
     that this is because --since-version was not specified.
     Closes:#883340.
+  * When quilt fixup fails because of discrepancies, print a
+    git diff rune which will show them.  Closes:#865446.
 
  --
 
diff --git a/dgit b/dgit
index 4535d8c3e67e5eab5e23cc493240ae7db0d17921..05cf90d2818bdd2f7da8cf89ca3a4d0ebc034d66 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -5065,10 +5065,12 @@ sub quiltify_splitbrain_needed () {
 sub quiltify_splitbrain ($$$$$$$) {
     my ($clogp, $unapplied, $headref, $oldtiptree, $diffbits,
        $editedignores, $cachekey) = @_;
+    my $gitignore_special = 1;
     if ($quilt_mode !~ m/gbp|dpm/) {
        # treat .gitignore just like any other upstream file
        $diffbits = { %$diffbits };
        $_ = !!$_ foreach values %$diffbits;
+       $gitignore_special = 0;
     }
     # We would like any commits we generate to be reproducible
     my @authline = clogp_authline($clogp);
@@ -5079,11 +5081,19 @@ sub quiltify_splitbrain ($$$$$$$) {
     local $ENV{GIT_AUTHOR_EMAIL} = $authline[1];
     local $ENV{GIT_AUTHOR_DATE} =  $authline[2];
 
+    my $fulldiffhint = sub {
+       my ($x,$y) = @_;
+       my $cmd = "git diff $x $y -- :/ ':!debian'";
+       $cmd .= " ':!/.gitignore' ':!*/.gitignore'" if $gitignore_special;
+       return "\nFor full diff showing the problem(s), type:\n $cmd\n";
+    };
+
     if ($quilt_mode =~ m/gbp|unapplied/ &&
        ($diffbits->{O2H} & 01)) {
        my $msg =
  "--quilt=$quilt_mode specified, implying patches-unapplied git tree\n".
  " but git tree differs from orig in upstream files.";
+       $msg .= $fulldiffhint->($unapplied, 'HEAD');
        if (!stat_exists "debian/patches") {
            $msg .=
  "\n ... debian/patches is missing; perhaps this is a patch queue branch?";
@@ -5092,7 +5102,7 @@ sub quiltify_splitbrain ($$$$$$$) {
     }
     if ($quilt_mode =~ m/dpm/ &&
        ($diffbits->{H2A} & 01)) {
-       fail <<END;
+       fail <<END. $fulldiffhint->($oldtiptree,'HEAD');
 --quilt=$quilt_mode specified, implying patches-applied git tree
  but git tree differs from result of applying debian/patches to upstream
 END
@@ -5108,7 +5118,7 @@ END
     }
     if ($quilt_mode =~ m/gbp|dpm/ &&
        ($diffbits->{O2A} & 02)) {
-       fail <<END
+       fail <<END;
 --quilt=$quilt_mode specified, implying that HEAD is for use with a
  tool which does not create patches for changes to upstream
  .gitignores: but, such patches exist in debian/patches.