diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2019-01-06 11:36:52 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2019-01-06 13:36:45 +0000 |
commit | a73c60edeaaf776cee0b9065b25ce312baccc49b (patch) | |
tree | e5fabcf0ece50f009762a9b9bcd1745a524eab82 | |
parent | 9453958d76cb530bbc0af1802cfeaadd26e19c6c (diff) |
dgit: cleaning: Improve handling of note about ignores
* Provide a new $ignmessage parameter to clean_tree_check_git and use
that. This makes it a bit easier to:
* Only print the additional message if the clean mode actually
honoured ignores. If it didn't then the problem is not `due
to missing .gitignore entries' because they would not have helped.
* Change all callers other than clean_tree_check_git_wd to
pass the empty string, so no other overall functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | dgit | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -6213,13 +6213,14 @@ sub maybe_unapply_patches_again () { #----- other building ----- -sub clean_tree_check_git ($$) { - my ($honour_ignores, $message) = @_; +sub clean_tree_check_git ($$$) { + my ($honour_ignores, $message, $ignmessage) = @_; my @cmd = (@git, qw(clean -dn)); push @cmd, qw(-x) unless $honour_ignores; my $leftovers = cmdoutput @cmd; if (length $leftovers) { print STDERR $leftovers, "\n" or confess $!; + $message .= $ignmessage if $honour_ignores; fail $message; } } @@ -6229,8 +6230,7 @@ sub clean_tree_check_git_wd ($) { return if $cleanmode =~ m{no-check}; return if $patches_applied_dirtily; # yuk clean_tree_check_git +($cleanmode !~ m{all-check}), - (f_ <<END, $message); -%s + $message, "\n".__ <<END; If this is just missing .gitignore entries, use a different clean mode, eg --clean=dpkg-source,no-check (-wdn/-wddn) to ignore them or --clean=git (-wg/-wgf) to use \`git clean' instead. @@ -6243,13 +6243,13 @@ sub clean_tree_check () { # the rules clean target which might modify tracked files (!) if ($cleanmode =~ m{^check}) { clean_tree_check_git +($cleanmode =~ m{ignores}), __ - "tree contains uncommitted files and --clean=check specified"; + "tree contains uncommitted files and --clean=check specified", ''; } elsif ($cleanmode =~ m{^dpkg-source}) { clean_tree_check_git_wd __ "tree contains uncommitted files (NB dgit didn't run rules clean)"; } elsif ($cleanmode =~ m{^git}) { - clean_tree_check_git_wd __ - "tree contains uncommitted files"; + clean_tree_check_git 1, __ + "tree contains uncommited, untracked, unignored files", ''; } elsif ($cleanmode eq 'none') { } else { confess "$cleanmode ?"; |