aboutsummaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorChris Rorvick <chris@rorvick.com>2012-11-29 19:41:36 -0600
committerJunio C Hamano <gitster@pobox.com>2012-12-02 01:44:15 -0800
commit8c5f6f717d136c5a0e9d6d3879bf2a7bdeb42154 (patch)
tree5679d8837348f4687f5b923933068ec98c7a10ba /remote.c
parentffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6 (diff)
downloadgit-8c5f6f717d136c5a0e9d6d3879bf2a7bdeb42154.tar.gz
git-8c5f6f717d136c5a0e9d6d3879bf2a7bdeb42154.tar.xz
push: flag updates that require force
Add a flag for indicating an update to a reference requires force. Currently the `nonfastforward` flag is used for this when generating the status message. A separate flag insulates dependent logic from the details of set_ref_status_for_push(). Signed-off-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/remote.c b/remote.c
index 07040b882..4a6f82208 100644
--- a/remote.c
+++ b/remote.c
@@ -1293,6 +1293,8 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
struct ref *ref;
for (ref = remote_refs; ref; ref = ref->next) {
+ int force_ref_update = ref->force || force_update;
+
if (ref->peer_ref)
hashcpy(ref->new_sha1, ref->peer_ref->new_sha1);
else if (!send_mirror)
@@ -1335,9 +1337,12 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
!has_sha1_file(ref->old_sha1)
|| !ref_newer(ref->new_sha1, ref->old_sha1);
- if (ref->nonfastforward && !ref->force && !force_update) {
- ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
- continue;
+ if (ref->nonfastforward) {
+ ref->requires_force = 1;
+ if (!force_ref_update) {
+ ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
+ continue;
+ }
}
}
}