summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-10 22:20:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-10 22:20:08 (GMT)
commit24abb31727e8e0b216bdee182dbbbbc43d134fa6 (patch)
treece40204a36f89e5344b906918238495954cef4db /remote.c
parenta3764e7da7ae2c30e2e1bbeaa0961a17bced2078 (diff)
parentb2e93f88cb94f487650beb93ff87ceb7ab68a0ed (diff)
downloadgit-24abb31727e8e0b216bdee182dbbbbc43d134fa6.zip
git-24abb31727e8e0b216bdee182dbbbbc43d134fa6.tar.gz
git-24abb31727e8e0b216bdee182dbbbbc43d134fa6.tar.bz2
Merge branch 'aw/push-force-with-lease-reporting'
"git push --force-with-lease" has been taught to report if the push needed to force (or fast-forwarded). * aw/push-force-with-lease-reporting: push: fix ref status reporting for --force-with-lease
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/remote.c b/remote.c
index 35940a5..02e698a 100644
--- a/remote.c
+++ b/remote.c
@@ -1548,11 +1548,8 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
}
/*
- * Bypass the usual "must fast-forward" check but
- * replace it with a weaker "the old value must be
- * this value we observed". If the remote ref has
- * moved and is now different from what we expect,
- * reject any push.
+ * If the remote ref has moved and is now different
+ * from what we expect, reject any push.
*
* It also is an error if the user told us to check
* with the remote-tracking branch to find the value
@@ -1563,10 +1560,14 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
if (ref->expect_old_no_trackback ||
oidcmp(&ref->old_oid, &ref->old_oid_expect))
reject_reason = REF_STATUS_REJECT_STALE;
+ else
+ /* If the ref isn't stale then force the update. */
+ force_ref_update = 1;
}
/*
- * The usual "must fast-forward" rules.
+ * If the update isn't already rejected then check
+ * the usual "must fast-forward" rules.
*
* Decide whether an individual refspec A:B can be
* pushed. The push will succeed if any of the
@@ -1585,7 +1586,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
* passing the --force argument
*/
- else if (!ref->deletion && !is_null_oid(&ref->old_oid)) {
+ if (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {
if (starts_with(ref->name, "refs/tags/"))
reject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;
else if (!has_object_file(&ref->old_oid))