diff options
author | Chris Rorvick <chris@rorvick.com> | 2012-11-29 19:41:37 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 01:44:34 -0800 |
commit | dbfeddb12e5bb540ed3c852eebda3df9117bd150 (patch) | |
tree | 7c5c6582390c7dabd839b72fafd074b4323b23d9 /transport.c | |
parent | push: flag updates that require force (diff) | |
download | tgif-dbfeddb12e5bb540ed3c852eebda3df9117bd150.tar.xz |
push: require force for refs under refs/tags/
References are allowed to update from one commit-ish to another if the
former is an ancestor of the latter. This behavior is oriented to
branches which are expected to move with commits. Tag references are
expected to be static in a repository, though, thus an update to
something under refs/tags/ should be rejected unless the update is
forced.
Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/transport.c b/transport.c index f3160b142f..2673d273ff 100644 --- a/transport.c +++ b/transport.c @@ -695,6 +695,10 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count, i print_ref_status('!', "[rejected]", ref, ref->peer_ref, "non-fast-forward", porcelain); break; + case REF_STATUS_REJECT_ALREADY_EXISTS: + print_ref_status('!', "[rejected]", ref, ref->peer_ref, + "already exists", porcelain); + break; case REF_STATUS_REMOTE_REJECT: print_ref_status('!', "[remote rejected]", ref, ref->deletion ? NULL : ref->peer_ref, @@ -740,12 +744,12 @@ void transport_print_push_status(const char *dest, struct ref *refs, ref->status != REF_STATUS_OK) n += print_one_push_status(ref, dest, n, porcelain); if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD) { - if (ref->not_forwardable) - *reject_reasons |= REJECT_ALREADY_EXISTS; if (!strcmp(head, ref->name)) *reject_reasons |= REJECT_NON_FF_HEAD; else *reject_reasons |= REJECT_NON_FF_OTHER; + } else if (ref->status == REF_STATUS_REJECT_ALREADY_EXISTS) { + *reject_reasons |= REJECT_ALREADY_EXISTS; } } } |