chiark / gitweb /
dgit: clean: Provide new --git[-ff],always clean mode
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 12:54:16 +0000 (12:54 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 13:36:46 +0000 (13:36 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 988eb948b72bec96aff5efb6f79fc270620995f3..87ab8625018c0d5ad47e576d7b27a3c832152704 100755 (executable)
--- 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