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-helper.c | |
parent | 8c5f6f717d136c5a0e9d6d3879bf2a7bdeb42154 (diff) | |
download | git-dbfeddb12e5bb540ed3c852eebda3df9117bd150.tar.gz |
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-helper.c')
-rw-r--r-- | transport-helper.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c index 4713b69302..965b778cb3 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -661,6 +661,11 @@ static void push_update_ref_status(struct strbuf *buf, free(msg); msg = NULL; } + else if (!strcmp(msg, "already exists")) { + status = REF_STATUS_REJECT_ALREADY_EXISTS; + free(msg); + msg = NULL; + } } if (*ref) @@ -720,6 +725,7 @@ static int push_refs_with_push(struct transport *transport, /* Check for statuses set by set_ref_status_for_push() */ switch (ref->status) { case REF_STATUS_REJECT_NONFASTFORWARD: + case REF_STATUS_REJECT_ALREADY_EXISTS: case REF_STATUS_UPTODATE: continue; default: |