chiark / gitweb /
dgit: Introduce build_prep_early
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:44:43 +0000 (19:44 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 22:18:12 +0000 (22:18 +0000)
Currently only one call site which is only ever called once.  We make
it idempotent since we're going to want that.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index af62eb503534920cea40a43ee3c10743026f6aca..ca907f3f8af2394aa450fdea52fb6a5b3100709b 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4963,15 +4963,21 @@ sub cmd_clean () {
     maybe_unapply_patches_again();
 }
 
-sub build_prep () {
+sub build_prep_early () {
+    our $build_prep_early_done //= 0;
+    return if $build_prep_early_done++;
     notpushing();
     badusage "-p is not allowed when building" if defined $package;
-    check_not_dirty();
-    clean_tree();
     my $clogp = parsechangelog();
     $isuite = getfield $clogp, 'Distribution';
     $package = getfield $clogp, 'Source';
     $version = getfield $clogp, 'Version';
+    check_not_dirty();
+}
+
+sub build_prep () {
+    build_prep_early();
+    clean_tree();
     build_maybe_quilt_fixup();
     if ($rmchanges) {
        my $pat = changespat $version;