diff options
author | Chris Rorvick <chris@rorvick.com> | 2012-11-29 19:41:35 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 01:43:28 -0800 |
commit | ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6 (patch) | |
tree | 28460138cde6d8c772b7da3838336c20437574f3 /remote.c | |
parent | b24e6047a8da3cddfd686e6a9157ed4bac28ed4f (diff) | |
download | git-ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6.tar.gz git-ffe81ef2ac5bcf83b9ab792e4d05ec95744a2fb6.tar.xz |
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.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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; + } } } } |