chiark / gitweb /
Revert "Dgit: Introduce in_workarea and fresh_workarea"
[dgit.git] / dgit
diff --git a/dgit b/dgit
index c17b42a967645446189383765216bce9a61ddb46..827dc62d0c866464b32123a44d92f6a9b78bba16 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -985,12 +985,6 @@ sub commit_getclogp ($) {
     $commit_getclogp_memo{$objid} = parsechangelog("-l$mclog");
 }
 
-sub must_getcwd () {
-    my $d = getcwd();
-    defined $d or fail "getcwd failed: $!";
-    return $d;
-}
-
 sub parse_dscdata () {
     my $dscfh = new IO::File \$dscdata, '<' or die $!;
     printdebug Dumper($dscdata) if $debuglevel>1;
@@ -1685,7 +1679,7 @@ sub prep_ud (;$) {
 }
 
 sub mktree_in_ud_here () {
-    workarea_setup $gitcfgs{local};
+    playtree_setup $gitcfgs{local};
 }
 
 sub git_write_tree () {
@@ -4494,10 +4488,9 @@ END
 
 sub prep_push () {
     parseopts();
-    badusage "-p is not allowed with dgit $subcommand" if defined $package;
+    build_or_push_prep_early();
+    pushing();
     check_not_dirty();
-    my $clogp = parsechangelog();
-    $package = getfield $clogp, 'Source';
     my $specsuite;
     if (@ARGV==0) {
     } elsif (@ARGV==1) {
@@ -4505,8 +4498,6 @@ sub prep_push () {
     } else {
        badusage "incorrect arguments to dgit $subcommand";
     }
-    $isuite = getfield $clogp, 'Distribution';
-    pushing();
     if ($new_package) {
        local ($package) = $existing_package; # this is a hack
        canonicalise_suite();
@@ -5822,14 +5813,18 @@ sub cmd_clean () {
     maybe_unapply_patches_again();
 }
 
-sub build_prep_early () {
-    our $build_prep_early_done //= 0;
-    return if $build_prep_early_done++;
-    badusage "-p is not allowed when building" if defined $package;
+sub build_or_push_prep_early () {
+    our $build_or_push_prep_early_done //= 0;
+    return if $build_or_push_prep_early_done++;
+    badusage "-p is not allowed with dgit $subcommand" if defined $package;
     my $clogp = parsechangelog();
     $isuite = getfield $clogp, 'Distribution';
     $package = getfield $clogp, 'Source';
     $version = getfield $clogp, 'Version';
+}
+
+sub build_prep_early () {
+    build_or_push_prep_early();
     notpushing();
     check_not_dirty();
 }