From 02201fcb3e2f7e92ccf115811c3e909a490f0a80 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 13 Oct 2018 11:56:06 +0100 Subject: [PATCH 1/1] dgit: Provide new clean mode --clean=check,ignores Signed-off-by: Ian Jackson --- dgit | 7 +++++-- dgit.1 | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dgit b/dgit index 351e089f..7eb05312 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 ccf1ea59..19a88fae 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. -- 2.30.2