X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=de697a15a22a1c1aeb5b84ef23e931baf30023a4;hb=8b2b16dc65e5606cb8e4c286b7baa066c6ee53f0;hp=4cbc378c87e7013634ab29dd6437eb50c742164b;hpb=a7a444f863e150475b2ab7ccc33576f68e08c734;p=dgit.git diff --git a/dgit b/dgit index 4cbc378c..de697a15 100755 --- a/dgit +++ b/dgit @@ -101,7 +101,11 @@ our %forceopts = map { $_=>0 } our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); our $suite_re = '[-+.0-9a-z]+'; -our $cleanmode_re = qr{(?:dpkg-source(?:-d)?|git|git-ff|check|none)}; +our $cleanmode_re = qr{(?: dpkg-source (?: -d )? + | git | git-ff + | check (?: ,ignores )? + | none + )}x; our $git_authline_re = '^([^<>]+) \<(\S+)\> (\d+ [-+]\d+)$'; our $splitbraincache = 'dgit-intern/quilt-cache'; @@ -6199,6 +6203,28 @@ 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}) { + clean_tree_check_git +($cleanmode =~ m{ignores}), __ + "tree contains uncommitted files and --clean=check specified"; + } +} + sub clean_tree () { # We always clean the tree ourselves, rather than leave it to the # builder (dpkg-source, or soemthing which calls dpkg-source). @@ -6212,23 +6238,14 @@ 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 confess $!; - fail __ - "tree contains uncommitted files and --clean=check specified"; - } + } elsif ($cleanmode =~ m{^check}) { + clean_tree_check(); } elsif ($cleanmode eq 'none') { } else { die "$cleanmode ?"; } } -sub clean_tree_check () { - # Not yet implemented. The lack of this is part of #910705. -} - sub cmd_clean () { badusage __ "clean takes no additional arguments" if @ARGV; notpushing(); @@ -7254,6 +7271,9 @@ sub parseopts () { } elsif (s/^-wc$//s) { push @ropts, $&; $cleanmode = 'check'; + } elsif (s/^-wci$//s) { + push @ropts, $&; + $cleanmode = 'check,ignores'; } elsif (s/^-c([^=]*)\=(.*)$//s) { push @git, '-c', $&; $gitcfgs{cmdline}{$1} = [ $2 ];