summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-18 14:19:47 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-19 15:29:01 +0100
commit236b11e106008dcf767ede43a5926d9b985f59e7 (patch)
treeae5ad3d1365e7dea12cebf313a95458ba7c2b8bd /dgit
parentea3d6683dcb55e588833e59af9f740709cd709b5 (diff)
Provide -wc aka --clean=check.
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit11
1 files changed, 10 insertions, 1 deletions
diff --git a/dgit b/dgit
index 47c55f3..1a2ee88 100755
--- 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);
+ } 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 ?";
@@ -2878,7 +2884,7 @@ sub parseopts () {
} 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) {
@@ -2959,6 +2965,9 @@ sub parseopts () {
} elsif (s/^-wdd$//s) {
push @ropts, $&;
$cleanmode = 'dpkg-source-d';
+ } elsif (s/^-wc$//s) {
+ push @ropts, $&;
+ $cleanmode = 'check';
} else {
badusage "unknown short option \`$_'";
}