chiark / gitweb /
dgit, git-debrebase: Properly make patches with nasty .gitignores.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 6 Jul 2018 20:17:18 +0000 (21:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 6 Jul 2018 20:29:22 +0000 (21:29 +0100)
Specifically:

 * When running git status --porcelain, pass --ignored so it
   lists ignored files, and handle the ! output that it then
   produces.

 * Add missing -f to a few git add invocations.

I have done some greps ('git.*add', 'git.*status', 'porcelain', etc.)
to try to find other missed cases and none turned up.

git diff is OK because normally we pass two treeish arguments, in
which case the ignores are ignored by git diff.  When we are asking it
to look at the working tree, we are expecting it to ignore untracked
files (whether ignored or not), and diff tracked ones, which is what
it does.

Closes:#903130.

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

index 04357f9c8d5aa92d9ca56ca80de945115e9f907a..375e783a75b71228d41de19a5f1de55340ab5ab6 100644 (file)
@@ -1,6 +1,8 @@
 dgit (5.8~) unstable; urgency=medium
 
   Bugfixes:
+  * dgit, git-debrebase: Properly make patches even if an awkward
+    .gitignore ignores the things in debian/patches.  Closes:#903130.
   * dgit(1): Unscramble push[-source] descriptions.  Closes:#903116.
 
  --
diff --git a/dgit b/dgit
index 3a737d0b0bbd607dc002542fdd9f582bf14edfaa..0d36361f2609a4d18f40e6e873c9ba262337202a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3812,11 +3812,11 @@ sub quiltify_nofix_bail ($$) {
 }
 
 sub commit_quilty_patch () {
-    my $output = cmdoutput @git, qw(status --porcelain);
+    my $output = cmdoutput @git, qw(status --ignored --porcelain);
     my %adds;
     foreach my $l (split /\n/, $output) {
        next unless $l =~ m/\S/;
-       if ($l =~ m{^(?:\?\?| [MADRC]) (.pc|debian/patches)}) {
+       if ($l =~ m{^(?:[?!][?!]| [MADRC]) (.pc|debian/patches)}) {
            $adds{$1}++;
        }
     }
@@ -5318,7 +5318,7 @@ END
        print SERIES "\n" or die $! unless $newline eq "\n";
        print SERIES "auto-gitignore\n" or die $!;
        close SERIES or die  $!;
-        runcmd @git, qw(add -- debian/patches/series), $gipatch;
+        runcmd @git, qw(add -f -- debian/patches/series), $gipatch;
         commit_admin <<END
 Commit patch to update .gitignore
 
index 658884d2d062fa5bb068ad2edd4d7e59bfd9bd1e..04befff5484477c888825954b20ae53c760ce983 100755 (executable)
@@ -1504,7 +1504,7 @@ sub make_patches_staged ($) {
            { local ($!,$?); copy('../gbp-pq-err', \*STDERR); }
            failedcmd @gbp_cmd;
        }
-       runcmd @git, qw(add debian/patches);
+       runcmd @git, qw(add -f debian/patches);
     };
 }