diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-10-13 12:26:19 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-10-13 12:53:31 +0100 |
commit | 8b2b16dc65e5606cb8e4c286b7baa066c6ee53f0 (patch) | |
tree | b7e98b22c82d1430012d962cc9694c704b7bb1b5 | |
parent | e629dfe6f8766b23c13613b27c6f0d7cbae346ab (diff) |
dgit: Break out clean_tre_check_git
This will make it easier to handle the other clean modes more clearly.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | dgit | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -6203,20 +6203,25 @@ sub maybe_unapply_patches_again () { #----- other building ----- +sub clean_tree_check_git ($$) { + my ($honour_ignores, $message) = @_; + 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 $!; + fail $message; + } +} + sub clean_tree_check () { # Not yet fully implemented. # This function needs to not care about modified but tracked files. # That was done by check_not_dirty, and by now we may have run # the rules clean target which might modify tracked files (!) if ($cleanmode =~ m{^check}) { - my @cmd = (@git, qw(clean -dn)); - push @cmd, qw(-x) unless $cleanmode =~ m{ignores}; - my $leftovers = cmdoutput @cmd; - if (length $leftovers) { - print STDERR $leftovers, "\n" or confess $!; - fail __ + clean_tree_check_git +($cleanmode =~ m{ignores}), __ "tree contains uncommitted files and --clean=check specified"; - } } } |