From 236b11e106008dcf767ede43a5926d9b985f59e7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 18 Jul 2015 14:19:47 +0100 Subject: Provide -wc aka --clean=check. --- debian/changelog | 1 + dgit | 11 ++++++++++- dgit.1 | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6e62f07..67086e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ dgit (0.31~~) unstable; urgency=low 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. 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 \`$_'"; } diff --git a/dgit.1 b/dgit.1 index 698bf2f..3e402e1 100644 --- 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 +.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 -- cgit v1.2.3