chiark / gitweb /
Push reorg: Introduce $archive_hash in dopush (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 Sep 2016 11:45:01 +0000 (12:45 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 Sep 2016 12:27:59 +0000 (13:27 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 55a20df84c70415c30389416f4a71404a5193f84..879adea2c6252f64e9bb9cae537cbb53744aa30f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2506,9 +2506,16 @@ END
     if (check_for_git()) {
        git_fetch_us();
     }
     if (check_for_git()) {
        git_fetch_us();
     }
+    my $archive_hash = fetch_from_archive();
+    if (!$archive_hash) {
+       $new_package or
+           fail "package appears to be new in this suite;".
+               " if this is intentional, use --new";
+    }
+
     my $forceflag = '';
     my $forceflag = '';
-    if (fetch_from_archive()) {
-       if (is_fast_fwd(lrref(), 'HEAD')) {
+    if ($archive_hash) {
+       if (is_fast_fwd($archive_hash, 'HEAD')) {
            # ok
        } elsif (deliberately_not_fast_forward) {
            $forceflag = '+';
            # ok
        } elsif (deliberately_not_fast_forward) {
            $forceflag = '+';
@@ -2520,10 +2527,6 @@ END
                "dgit: To rewind history, if permitted by the archive,".
                " use --deliberately-not-fast-forward";
        }
                "dgit: To rewind history, if permitted by the archive,".
                " use --deliberately-not-fast-forward";
        }
-    } else {
-       $new_package or
-           fail "package appears to be new in this suite;".
-               " if this is intentional, use --new";
     }
 
     supplementary_message(<<'END');
     }
 
     supplementary_message(<<'END');