summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-10-13 11:56:06 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-10-13 12:53:31 +0100
commit02201fcb3e2f7e92ccf115811c3e909a490f0a80 (patch)
tree94583a6ce7fc2cb707830f11bad7ec73bd6255e9
parente289b3f481be490065d59067918eabae6a180b47 (diff)
dgit: Provide new clean mode --clean=check,ignores
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit7
-rw-r--r--dgit.113
2 files changed, 17 insertions, 3 deletions
diff --git a/dgit b/dgit
index 351e089..7eb0531 100755
--- 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
- | check
+ | check (?: ,ignores )?
| 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));
- 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 $!;
@@ -7266,6 +7266,9 @@ sub parseopts () {
} 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 ];
diff --git a/dgit.1 b/dgit.1
index ccf1ea5..19a88fa 100644
--- 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
-.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.
+
+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.