chiark / gitweb /
dgit: Provide new clean mode --clean=check,ignores
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 10:56:06 +0000 (11:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 11:53:31 +0000 (12:53 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit
dgit.1

diff --git a/dgit b/dgit
index 351e089fbae125578a5a068c6b0344fdc6dcfb1d..7eb05312d3114d3a97aec5705256c91e5d4a1518 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -103,7 +103,7 @@ our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 our $suite_re = '[-+.0-9a-z]+';
 our $cleanmode_re = qr{(?: dpkg-source (?: -d )?
                          | git | git-ff
 our $suite_re = '[-+.0-9a-z]+';
 our $cleanmode_re = qr{(?: dpkg-source (?: -d )?
                          | git | git-ff
-                         | check
+                         | check (?: ,ignores )?
                          | none
                          )}x;
 
                          | none
                          )}x;
 
@@ -6210,7 +6210,7 @@ sub clean_tree_check () {
     # the rules clean target which might modify tracked files (!)
     if ($cleanmode =~ m{^check}) {
        my @cmd = (@git, qw(clean -dn));
     # the rules clean target which might modify tracked files (!)
     if ($cleanmode =~ m{^check}) {
        my @cmd = (@git, qw(clean -dn));
-       push @cmd, qw(-x);
+       push @cmd, qw(-x) unless $cleanmode =~ m{ignores};
        my $leftovers = cmdoutput @cmd;
        if (length $leftovers) {
            print STDERR $leftovers, "\n" or confess $!;
        my $leftovers = cmdoutput @cmd;
        if (length $leftovers) {
            print STDERR $leftovers, "\n" or confess $!;
@@ -7266,6 +7266,9 @@ sub parseopts () {
                } elsif (s/^-wc$//s) {
                    push @ropts, $&;
                    $cleanmode = 'check';
                } elsif (s/^-wc$//s) {
                    push @ropts, $&;
                    $cleanmode = 'check';
+               } elsif (s/^-wci$//s) {
+                   push @ropts, $&;
+                   $cleanmode = 'check,ignores';
                } elsif (s/^-c([^=]*)\=(.*)$//s) {
                    push @git, '-c', $&;
                    $gitcfgs{cmdline}{$1} = [ $2 ];
                } elsif (s/^-c([^=]*)\=(.*)$//s) {
                    push @git, '-c', $&;
                    $gitcfgs{cmdline}{$1} = [ $2 ];
diff --git a/dgit.1 b/dgit.1
index ccf1ea597e111bb447ca86795992ae67f7883001..19a88fae79ff6b633f4fb83ac0f4051b39df8059 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -548,11 +548,22 @@ git clean -xdf
 but it also removes any subdirectories containing different git
 trees (which only unusual packages are likely to create).
 .TP
 but it also removes any subdirectories containing different git
 trees (which only unusual packages are likely to create).
 .TP
-.BR --clean=check " | " -wc
+.BR --clean=check " | " --clean=check,ignores " | " -wc " | " -wci
 Merely check that the tree is clean (does not contain uncommitted
 files).
 Avoids running rules clean,
 and can avoid needing the build-dependencies.
 Merely check that the tree is clean (does not contain uncommitted
 files).
 Avoids running rules clean,
 and can avoid needing the build-dependencies.
+
+With
+.BR ,ignores
+or
+.BR -wci ,
+untracked files covered by .gitignore are tolerated,
+so only files which show up as
+.B ?
+in git status
+(ie, ones you maybe forgot to git add)
+are treated as a problem.
 .TP
 .BR --clean=none " | " -wn
 Do not clean the tree, nor check that it is clean.
 .TP
 .BR --clean=none " | " -wn
 Do not clean the tree, nor check that it is clean.