chiark / gitweb /
Provide -wc aka --clean=check.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 Jul 2015 13:19:47 +0000 (14:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jul 2015 14:29:01 +0000 (15:29 +0100)
debian/changelog
dgit
dgit.1

index 6e62f073a02a44f0720f2393acb447c60a4ef85c..67086e0fc826c45a8a2fec49927cf0d60fd98111 100644 (file)
@@ -6,6 +6,7 @@ dgit (0.31~~) unstable; urgency=low
 
   Useability improvements:
   * Provide -wdd aka --clean=dpkg-source-d.  Closes:#792433.
 
   Useability improvements:
   * Provide -wdd aka --clean=dpkg-source-d.  Closes:#792433.
+  * Provide -wc aka --clean=check.
 
   Infrastructure:
   * Provide for mirroring git updates to a different server.
 
   Infrastructure:
   * Provide for mirroring git updates to a different server.
diff --git a/dgit b/dgit
index 47c55f3905217dd0b25eb0490608889132ca6c22..1a2ee88feabca1487696f6abf7d3a406329de9b0 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2639,6 +2639,12 @@ sub clean_tree () {
        runcmd_ordryrun_local @git, qw(clean -xdf);
     } elsif ($cleanmode eq 'git-ff') {
        runcmd_ordryrun_local @git, qw(clean -xdff);
        runcmd_ordryrun_local @git, qw(clean -xdf);
     } elsif ($cleanmode eq 'git-ff') {
        runcmd_ordryrun_local @git, qw(clean -xdff);
+    } elsif ($cleanmode eq 'check') {
+       my $leftovers = cmdoutput @git, qw(clean -xdn);
+       if (length $leftovers) {
+           print STDERR $leftovers, "\n" or die $!;
+           fail "tree contains uncommitted files and --clean=check specified";
+       }
     } elsif ($cleanmode eq 'none') {
     } else {
        die "$cleanmode ?";
     } elsif ($cleanmode eq 'none') {
     } else {
        die "$cleanmode ?";
@@ -2878,7 +2884,7 @@ sub parseopts () {
            } elsif (m/^--build-products-dir=(.*)/s) {
                push @ropts, $_;
                $buildproductsdir = $1;
            } elsif (m/^--build-products-dir=(.*)/s) {
                push @ropts, $_;
                $buildproductsdir = $1;
-           } elsif (m/^--clean=(dpkg-source(?:-d)?|git|git-ff|none)$/s) {
+           } elsif (m/^--clean=(dpkg-source(?:-d)?|git|git-ff|check|none)$/s) {
                push @ropts, $_;
                $cleanmode = $1;
            } elsif (m/^--clean=(.*)$/s) {
                push @ropts, $_;
                $cleanmode = $1;
            } elsif (m/^--clean=(.*)$/s) {
@@ -2959,6 +2965,9 @@ sub parseopts () {
                } elsif (s/^-wdd$//s) {
                    push @ropts, $&;
                    $cleanmode = 'dpkg-source-d';
                } elsif (s/^-wdd$//s) {
                    push @ropts, $&;
                    $cleanmode = 'dpkg-source-d';
+               } elsif (s/^-wc$//s) {
+                   push @ropts, $&;
+                   $cleanmode = 'check';
                } else {
                    badusage "unknown short option \`$_'";
                }
                } else {
                    badusage "unknown short option \`$_'";
                }
diff --git a/dgit.1 b/dgit.1
index 698bf2fdd0369cc8ef8bd91e069e52cb519b3248..3e402e19022a4edd0435dad81da9857a76f6520c 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -278,6 +278,10 @@ This is like
 but it also removes any subdirectories containing different git
 trees (which only unusual packages are likely to create).
 .TP
 but it also removes any subdirectories containing different git
 trees (which only unusual packages are likely to create).
 .TP
+.BR --clean=check " | " -wn
+Merely check that the tree is clean (does not contain uncommitted
+files), before building a source package.
+.TP
 .BR --clean=none " | " -wn
 Do not clean the tree before building a source package.  If there are
 files which are not in git, or if the build creates such files, a
 .BR --clean=none " | " -wn
 Do not clean the tree before building a source package.  If there are
 files which are not in git, or if the build creates such files, a