git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/7] push: clarify rejection of update to non-commit-ish

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 26, 2012, 18:53 UTC
Message-ID
<7vk3t8ryap.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1353644515-17349-8-git-send-email-chris@rorvick.com>
Chris Rorvick <chris@rorvick.com> writes:
Show 24 quoted lines
> Pushes must already (by default) update to a commit-ish due the fast-
> forward check in set_ref_status_for_push().  But rejecting for not being
> a fast-forward suggests the situation can be resolved with a merge.
> Flag these updates (i.e., to a blob or a tree) as not forwardable so the
> user is presented with more appropriate advice.
>
> Signed-off-by: Chris Rorvick <chris@rorvick.com>
> ---
>  remote.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/remote.c b/remote.c
> index f5bc4e7..ee0c1e5 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1291,6 +1291,11 @@ static inline int is_forwardable(struct ref* ref)
>  	if (!o || o->type != OBJ_COMMIT)
>  		return 0;
>  
> +	/* new object must be commit-ish */
> +	o = deref_tag(parse_object(ref->new_sha1), NULL, 0);
> +	if (!o || o->type != OBJ_COMMIT)
> +		return 0;
> +

I think the original code used ref_newer() which took commit-ish on both sides.

With this code, the old must be a commit but new can be a tag that points at a commit? Why?

Previous: Chris RorvickNext: Chris Rorvick
Message 16 of 18 in “push: update remote tags only with force”
  1. 0/7 push: update remote tags only with forceChris Rorvick, Nov 23, 2012
  2. 1/7 push: return reject reasons via a maskChris Rorvick, Nov 23, 2012
  3. Junio C HamanoNov 26, 2012
  4. Chris RorvickNov 27, 2012
  5. 2/7 push: add advice for rejected tag referenceChris Rorvick, Nov 23, 2012
  6. 3/7 push: flag updatesChris Rorvick, Nov 23, 2012
  7. 4/7 push: flag updates that require forceChris Rorvick, Nov 23, 2012
  8. 5/7 push: require force for refs under refs/tags/Chris Rorvick, Nov 23, 2012
  9. Junio C HamanoNov 26, 2012
  10. Chris RorvickNov 27, 2012
  11. Junio C HamanoNov 27, 2012
  12. push: cleanup push rules commentChris Rorvick, Nov 28, 2012
  13. Junio C HamanoNov 28, 2012
  14. 6/7 push: require force for annotated tagsChris Rorvick, Nov 23, 2012
  15. 7/7 push: clarify rejection of update to non-commit-ishChris Rorvick, Nov 23, 2012
  16. Junio C HamanoNov 26, 2012
  17. Chris RorvickNov 27, 2012
  18. Junio C HamanoNov 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.