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.