chiark / gitweb /
dgit: Break out deliberately_not_fast_forward (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 27 May 2015 20:35:15 +0000 (21:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 11:58:15 +0000 (12:58 +0100)
dgit

diff --git a/dgit b/dgit
index 759df20e5df761a58e05418538283e48003ebb07..6e9c3044f54d745e4371209d51208f7ec1d372b2 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -162,6 +162,11 @@ sub deliberately ($) {
     return !!grep { $_ eq "--deliberately-$enquiry" } @deliberatelies;
 }
 
     return !!grep { $_ eq "--deliberately-$enquiry" } @deliberatelies;
 }
 
+sub deliberately_not_fast_forward () {
+    deliberately('not-fast-forward') ||
+       deliberately('TEST-not-fast-forward-dgit-only');
+}
+
 #---------- remote protocol support, common ----------
 
 # remote push initiator/responder protocol:
 #---------- remote protocol support, common ----------
 
 # remote push initiator/responder protocol:
@@ -1816,8 +1821,7 @@ sub cmd_push {
     if (fetch_from_archive()) {
        if (is_fast_fwd(lrref(), 'HEAD')) {
            # ok
     if (fetch_from_archive()) {
        if (is_fast_fwd(lrref(), 'HEAD')) {
            # ok
-       } elsif (deliberately('not-fast-forward') ||
-                deliberately('TEST-not-fast-forward-dgit-only')) {
+       } elsif (deliberately_not_fast_forward) {
            $forceflag = '+';
        } else {
            fail "dgit push: HEAD is not a descendant".
            $forceflag = '+';
        } else {
            fail "dgit push: HEAD is not a descendant".