X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=6cf10fb4deb2f6add3a267532a207ab193f33e84;hp=9c1f3e51e02d3697ec2a0b3875eabe0568ca4dc7;hb=f15061e0b700cc7102eee181b022070a18927039;hpb=cadb4c6130bb56b2be42c8efdbcbfbf9e2e1423f diff --git a/dgit b/dgit index 9c1f3e51..6cf10fb4 100755 --- a/dgit +++ b/dgit @@ -6199,36 +6199,44 @@ sub maybe_unapply_patches_again () { #----- other building ----- +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); + my $leftovers = cmdoutput @cmd; + if (length $leftovers) { + print STDERR $leftovers, "\n" or confess $!; + fail __ + "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). - if ($cleanmode eq 'dpkg-source') { - maybe_apply_patches_dirtily(); - runcmd_ordryrun_local @dpkgbuildpackage, qw(-T clean); - } elsif ($cleanmode eq 'dpkg-source-d') { + if ($cleanmode =~ m{^dpkg-source}) { + my @cmd = @dpkgbuildpackage; + push @cmd, qw(-d) if $cleanmode =~ m{^dpkg-source-d}; + push @cmd, qw(-T clean); maybe_apply_patches_dirtily(); - runcmd_ordryrun_local @dpkgbuildpackage, qw(-d -T clean); + runcmd_ordryrun_local @cmd; } elsif ($cleanmode eq 'git') { 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();