summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-08 14:42:40 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-22 22:33:21 -0700
commit631b5ef219c41027c144218e25075062b91f9471 (patch)
treebe26e0d749b7c4826c9e7874f70432de504b33c4 /transport-helper.c
parent91048a9537a4716c84934e4f8ed114a20606d3ff (diff)
downloadgit-631b5ef219c41027c144218e25075062b91f9471.tar.gz
push --force-with-lease: tie it all together
This teaches the deepest part of the callchain for "git push" (and "git send-pack") to enforce "the old value of the ref must be this, otherwise fail this push" (aka "compare-and-swap" / "--lockref"). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c
index db9bd18298..95d22f8d96 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -683,6 +683,11 @@ static int push_update_ref_status(struct strbuf *buf,
free(msg);
msg = NULL;
}
+ else if (!strcmp(msg, "stale info")) {
+ status = REF_STATUS_REJECT_STALE;
+ free(msg);
+ msg = NULL;
+ }
}
if (*ref)
@@ -756,6 +761,7 @@ static int push_refs_with_push(struct transport *transport,
/* Check for statuses set by set_ref_status_for_push() */
switch (ref->status) {
case REF_STATUS_REJECT_NONFASTFORWARD:
+ case REF_STATUS_REJECT_STALE:
case REF_STATUS_REJECT_ALREADY_EXISTS:
case REF_STATUS_UPTODATE:
continue;