summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-05-17 14:16:23 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-05-31 11:54:14 +0100
commit5f9258f673404e784b450631b39ba433a1fda945 (patch)
tree2e10f603cc7051bd3e063a0665edd4b1c661403b /dgit
parenteb3b3a8f4be0903cd73193e563c7b56ad48bf54e (diff)
dgit: Allow --deliberately-not-fast-forward to override dgit's fast forward check
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit20
1 files changed, 15 insertions, 5 deletions
diff --git a/dgit b/dgit
index 5d239d6..3d36280 100755
--- a/dgit
+++ b/dgit
@@ -1658,7 +1658,8 @@ sub sign_changes ($) {
}
}
-sub dopush () {
+sub dopush ($) {
+ my ($forceflag) = @_;
printdebug "actually entering push\n";
prep_ud();
@@ -1737,7 +1738,6 @@ sub dopush () {
responder_send_command("param head $head");
responder_send_command("param csuite $csuite");
- my $forceflag = deliberately('not-fast-forward') ? '+' : '';
if ($forceflag && defined $lastpush_hash) {
git_for_each_tag_referring($lastpush_hash, sub {
my ($objid,$fullrefname,$tagname) = @_;
@@ -1902,17 +1902,27 @@ sub cmd_push {
if (check_for_git()) {
git_fetch_us();
}
+ my $forceflag = '';
if (fetch_from_archive()) {
- is_fast_fwd(lrref(), 'HEAD') or
+ if (is_fast_fwd(lrref(), 'HEAD')) {
+ # ok
+ } elsif (deliberately('not-fast-forward') ||
+ deliberately('TEST-not-fast-forward-dgit-only')) {
+ $forceflag = '+';
+ } else {
fail "dgit push: HEAD is not a descendant".
" of the archive's version.\n".
- "$us: To overwrite it, use git merge -s ours ".lrref().".";
+ "$us: To overwrite its contents,".
+ " use git merge -s ours ".lrref().".\n".
+ "$us: 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();
+ dopush($forceflag);
}
#---------- remote commands' implementation ----------