From 54aa7290e5498423429298dee1de2f013d1576fa Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 18 Sep 2016 12:13:52 +0100 Subject: [PATCH] Push reorg: Move ff check out of cmd_push into dpush (nfc) Signed-off-by: Ian Jackson --- dgit | 59 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/dgit b/dgit index 95398497..af3a96a5 100755 --- a/dgit +++ b/dgit @@ -2493,9 +2493,36 @@ sub sign_changes ($) { } } -sub dopush ($) { - my ($forceflag) = @_; +sub dopush () { printdebug "actually entering push\n"; + + supplementary_message(<<'END'); +Push failed, while checking state of the archive. +You can retry the push, after fixing the problem, if you like. +END + if (check_for_git()) { + git_fetch_us(); + } + my $forceflag = ''; + if (fetch_from_archive()) { + if (is_fast_fwd(lrref(), 'HEAD')) { + # ok + } elsif (deliberately_not_fast_forward) { + $forceflag = '+'; + } else { + fail "dgit push: HEAD is not a descendant". + " of the archive's version.\n". + "dgit: To overwrite its contents,". + " use git merge -s ours ".lrref().".\n". + "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'); Push failed, while preparing your push. You can retry the push, after fixing the problem, if you like. @@ -2813,33 +2840,7 @@ sub cmd_push { fail "dgit push: changelog specifies $isuite ($csuite)". " but command line specifies $specsuite"; } - supplementary_message(<<'END'); -Push failed, while checking state of the archive. -You can retry the push, after fixing the problem, if you like. -END - if (check_for_git()) { - git_fetch_us(); - } - my $forceflag = ''; - if (fetch_from_archive()) { - if (is_fast_fwd(lrref(), 'HEAD')) { - # ok - } elsif (deliberately_not_fast_forward) { - $forceflag = '+'; - } else { - fail "dgit push: HEAD is not a descendant". - " of the archive's version.\n". - "dgit: To overwrite its contents,". - " use git merge -s ours ".lrref().".\n". - "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"; - } - dopush($forceflag); + dopush(); } #---------- remote commands' implementation ---------- -- 2.30.2