summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorChris Rorvick <chris@rorvick.com>2012-11-30 01:41:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-02 09:43:28 (GMT)
commitffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6 (patch)
tree28460138cde6d8c772b7da3838336c20437574f3 /remote.c
parentb24e6047a8da3cddfd686e6a9157ed4bac28ed4f (diff)
downloadgit-ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6.zip
git-ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6.tar.gz
git-ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6.tar.bz2
push: keep track of "update" state separately
If the reference exists on the remote and it is not being removed, then mark as an update. This is in preparation for handling tags (lightweight and annotated) exceptionally. 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.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/remote.c b/remote.c
index 5101683..07040b8 100644
--- a/remote.c
+++ b/remote.c
@@ -1326,15 +1326,19 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
ref->not_forwardable = !is_forwardable(ref);
- ref->nonfastforward =
+ ref->update =
!ref->deletion &&
- !is_null_sha1(ref->old_sha1) &&
- (!has_sha1_file(ref->old_sha1)
- || !ref_newer(ref->new_sha1, ref->old_sha1));
+ !is_null_sha1(ref->old_sha1);
- if (ref->nonfastforward && !ref->force && !force_update) {
- ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
- continue;
+ if (ref->update) {
+ ref->nonfastforward =
+ !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;
+ }
}
}
}