From b24e6047a8da3cddfd686e6a9157ed4bac28ed4f Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Thu, 29 Nov 2012 19:41:34 -0600 Subject: push: add advice for rejected tag reference Advising the user to fetch and merge only makes sense if the rejected reference is a branch. If none of the rejections are for branches, just tell the user the reference already exists. Signed-off-by: Chris Rorvick Signed-off-by: Junio C Hamano --- remote.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 04fd9ea4bd..51016831b9 100644 --- a/remote.c +++ b/remote.c @@ -1279,6 +1279,14 @@ int match_push_refs(struct ref *src, struct ref **dst, return 0; } +static inline int is_forwardable(struct ref* ref) +{ + if (!prefixcmp(ref->name, "refs/tags/")) + return 0; + + return 1; +} + void set_ref_status_for_push(struct ref *remote_refs, int send_mirror, int force_update) { @@ -1316,6 +1324,8 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror, * always allowed. */ + ref->not_forwardable = !is_forwardable(ref); + ref->nonfastforward = !ref->deletion && !is_null_sha1(ref->old_sha1) && -- cgit v1.2.1