summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-06 11:36:35 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-06 15:43:37 -0700
commitf2f60a5935e3673e6df2a45b25c961587d9a2186 (patch)
treebb233b5cde90ce1483d434f0acaca6d2e26e1b69 /transport.c
parent50ff9ea4a0770c8b1bfe3f98f09728427c0c6cc7 (diff)
downloadgit-jc/allow-lazy-cas.tar.gz
push: disable lazy --force-with-lease by defaultjc/allow-lazy-cas
"git push --force-with-lease=<branch>:<expect>" makes sure that there is no unexpected changes to the branch at the remote while you prepare a rewrite based on the old state of the branch. This feature came with an experimental option that allows :<expect> part to be omitted by using the tip of remote-tracking branch that corresponds to the <branch>. It turns out that some people use third-party tools that fetch from remote and update the remote-tracking branches behind users' back, defeating the safety that relies on the stability of the remote-tracking branches. We have some warning text that was meant to sound scary in our documentation, but nevertheless people seem to be bitten. See https://public-inbox.org/git/1491617750.2149.10.camel@mattmccutchen.net/ for a recent example. Let's disable the forms that rely on the stability of remote-tracking branches by default, and allow users who _know_ their remote-tracking branches are stable to enable it with a configuration variable. This problem was predicted from the very beginning; see 28f5d176 (remote.c: add command line option parser for "--force-with-lease", 2013-07-08). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/transport.c b/transport.c
index d75ff0514d..25eeb99a36 100644
--- a/transport.c
+++ b/transport.c
@@ -418,6 +418,10 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count,
print_ref_status('!', "[rejected]", ref, ref->peer_ref,
"stale info", porcelain, summary_width);
break;
+ case REF_STATUS_REJECT_LAZY_CAS:
+ print_ref_status('!', "[rejected]", ref, ref->peer_ref,
+ "lazy force-with-lease", porcelain, summary_width);
+ break;
case REF_STATUS_REJECT_SHALLOW:
print_ref_status('!', "[rejected]", ref, ref->peer_ref,
"new shallow roots not allowed",
@@ -934,6 +938,7 @@ static int run_pre_push_hook(struct transport *transport,
if (!r->peer_ref) continue;
if (r->status == REF_STATUS_REJECT_NONFASTFORWARD) continue;
if (r->status == REF_STATUS_REJECT_STALE) continue;
+ if (r->status == REF_STATUS_REJECT_LAZY_CAS) continue;
if (r->status == REF_STATUS_UPTODATE) continue;
strbuf_reset(&buf);