From: Ian Jackson Date: Wed, 20 Jun 2018 23:34:03 +0000 (+0100) Subject: dgit: Improve message for discrepant quilt fixup X-Git-Tag: archive/debian/5.2~14 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=1dd14bbf4f9cb4b6e973aa2813070c0847d71c31 dgit: Improve message for discrepant quilt fixup When quilt fixup fails because of discrepancies, print a git diff rune which will show them. Closes:#865446. Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index da734308..3216e4aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 4535d8c3..05cf90d2 100755 --- 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 <($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 <