chiark / gitweb /
dgit: Move clean_tree_check
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 9c1f3e51e02d3697ec2a0b3875eabe0568ca4dc7..b4943a23d70118c7c177b737798e40b6622f6679 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6199,15 +6199,19 @@ sub maybe_unapply_patches_again () {
 
 #----- other building -----
 
+sub clean_tree_check () {
+    # Not yet implemented.  The lack of this is part of #910705.
+}
+
 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') {
@@ -6225,10 +6229,6 @@ sub clean_tree () {
     }
 }
 
-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();