summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2019-01-06 12:54:16 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2019-01-06 13:36:46 +0000
commitdd2e4ce5738b2a41b4a18d7a8ff87a32692a2aac (patch)
tree452f029f596becae0ad5360f519aafc397bb148d
parenta73c60edeaaf776cee0b9065b25ce312baccc49b (diff)
dgit: clean: Provide new --git[-ff],always clean mode
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit9
1 files changed, 6 insertions, 3 deletions
diff --git a/dgit b/dgit
index 988eb94..87ab862 100755
--- a/dgit
+++ b/dgit
@@ -102,7 +102,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 )? (?: ,no-check | ,all-check )?
- | (?: git | git-ff )
+ | (?: git | git-ff ) (?: ,always )?
| check (?: ,ignores )?
| none
)}x;
@@ -6249,7 +6249,8 @@ sub clean_tree_check () {
"tree contains uncommitted files (NB dgit didn't run rules clean)";
} elsif ($cleanmode =~ m{^git}) {
clean_tree_check_git 1, __
- "tree contains uncommited, untracked, unignored files", '';
+ "tree contains uncommited, untracked, unignored files\n".
+ "You can use --clean=git[-ff],always (-wga/-wgfa) to delete them.", '';
} elsif ($cleanmode eq 'none') {
} else {
confess "$cleanmode ?";
@@ -6312,10 +6313,12 @@ sub build_prep ($) {
my ($wantsrc) = @_;
build_prep_early();
check_bpd_exists();
- if (!building_source_in_playtree() || ($wantsrc & WANTSRC_BUILDER)) {
+ if (!building_source_in_playtree() || ($wantsrc & WANTSRC_BUILDER)
# Clean the tree because we're going to use the contents of
# $maindir. (We trying to include dirty changes in the source
# package, or we are running the builder in $maindir.)
+ || $cleanmode =~ m{always}) {
+ # Or because the user asked us to.
clean_tree();
} else {
# We don't actually need to do anything in $maindir, but we