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

Re: [PATCH] diff: fix --merge-base with annotated tags

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 2, 2023, 18:54 UTC
Message-ID
<xmqq4jj84zyb.fsf@gitster.g>
In-Reply-To
<20231001151845.3621551-1-hi@alyssa.is>
Alyssa Ross <hi@alyssa.is> writes:
Show 8 quoted lines
> Checking early for OBJ_COMMIT excludes other objects that can be
> resolved to commits, like annotated tags.  If we remove it, annotated
> tags will be resolved and handled just fine by
> lookup_commit_reference(), and if we are given something that can't be
> resolved to a commit, we'll still get a useful error message, e.g.:
>
>> error: object 21ab162211ac3ef13c37603ca88b27e9c7e0d40b is a tree, not a commit
>> fatal: no merge base found

Interesting. 0f5a1d44 (builtin/diff-index: learn --merge-base, 2020-09-20) claims that it took inspiration from "git diff A...B" but forgot that it needs to accept any commit-ish.

With a devil's advocate hat on, I have to wonder if it is really a useful error message to spew a long hexadecimal string when the user would certainly have gave a more mnemonic HEAD^{tree} or something, but the original message does not say which command line argument it did not like anyway, so the patch is a net improvement.

Will queue.  Thanks.
Previous: Alyssa Ross
Message 2 of 2 in “diff: fix --merge-base with annotated tags”
  1. diff: fix --merge-base with annotated tagsAlyssa Ross, Oct 1, 2023
  2. Junio C HamanoOct 2, 2023

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.