From dd2e4ce5738b2a41b4a18d7a8ff87a32692a2aac Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 6 Jan 2019 12:54:16 +0000 Subject: [PATCH] dgit: clean: Provide new --git[-ff],always clean mode Signed-off-by: Ian Jackson --- dgit | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dgit b/dgit index 988eb948..87ab8625 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 -- 2.30.2