Re: [PATCH v3 09/12] get_short_oid / peel_onion: ^{tree} should be tree, not treeish
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 3, 2018, 05:28 UTC
- Message-ID
- <xmqqzi1htij7.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180501184016.15061-10-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 11 quoted lines
> But ^{tree} shows just the trees, but would previously be equivalent
> to the above:
>
> $ git rev-parse e8f2^{tree}
> error: short SHA1 e8f2 is ambiguous
> hint: The candidates are:
> hint: e8f2093055 tree
> hint: e8f25a3a50 tree
> hint: e8f28d537c tree
> hint: e8f2cf6ec0 tree
> [...]When a user says "git $cmd e8f2^{tree}", the user is telling Git that s/he knows e8f2 *is* a tree-ish, but for whatever reason $cmd wants a tree and does not accept an arbitrary tree-ish---that is the whole piont of appending ^{tree} as a suffix. A useful hint in such a case would be "oh, you said e8f2 is a tree-ish, but there are more than one tree-ish, so let me show them to you to help you decide which one among them is the one you meant". When $cmd is rev-parse, I would even say that the user is saying "I know e8f2 is a tree-ish, and I know it not a tree--it merely is a tree-ish. I want the tree that e8f2 thing points at".
Limiting that hint to show only real trees does not make any sense to me. I do not think we care _too_ deeply, because most of the time, command line location that expects a tree-ish can be given a tree-ish, so there is not much reason to use ^{tree} suffix these days. But in a case where it _does_ matter, I think this change makes the "hint" almost useless.
Or am I misleading what you wanted to achieve with this patch?