Re: [PATCH v4 6/6] get_short_oid: document & warn if we ignore the type selector
From: Martin Ågren <hidden>
Date: 2018-05-10 13:15:09
On 10 May 2018 at 14:43, Ævar Arnfjörð Bjarmason [off-list ref] wrote:
The SHA1 prefix 06fa currently matches no blobs in git.git. When
disambiguating short SHA1s we've been quietly ignoring the user's type
selector as a fallback mechanism, this was intentionally added in
1ffa26c461 ("get_short_sha1: list ambiguous objects on error",
2016-09-26).
I think that behavior makes sense, it's not very useful to just show
nothing because a preference has been expressed via core.disambiguate,
but it's bad that we're quietly doing this. The user might thing that
we just didn't understand what e.g 06fa^{blob} meant.
Now we'll instead print a warning if no objects of the requested type
were found:
$ git rev-parse 06fa^{blob}
error: short SHA1 06fa is ambiguous
hint: The candidates are:
[... no blobs listed ...]
warning: Your hint (via core.disambiguate or peel syntax) was ignored, we fell
back to showing all object types since no object of the requested type
matched the provide short SHA1 06fas/ignored, we/ignored. We/? IMHO, it would read easier. s/provide short/provided short/ Also: s/SHA1/object id/? That said, you add the warning. The error message is already there and you are simply following its "SHA1". Martin