Re: [PATCH 10/10] get_short_sha1: list ambiguous objects on error
- From
Kyle J. McKay <mackyle@gmail.com>
- Date
- Sep 29, 2016, 11:46 UTC
- Message-ID
- <2242637D-4C3B-4AF2-8BE4-823B3E1745D5@gmail.com>
- In-Reply-To
- <20160926120036.mqs435a36njeihq6@sigill.intra.peff.net>
On Sep 26, 2016, at 05:00, Jeff King wrote:
Show 14 quoted lines
> $ git rev-parse b2e1 > error: short SHA1 b2e1 is ambiguous > hint: The candidates are: > hint: b2e1196 tag v2.8.0-rc1 > hint: b2e11d1 tree > hint: b2e1632 commit 2007-11-14 - Merge branch 'bs/maint-commit- > options' > hint: b2e1759 blob > hint: b2e18954 blob > hint: b2e1895c blob > fatal: ambiguous argument 'b2e1': unknown revision or path not in > the working tree. > Use '--' to separate paths from revisions, like this: > 'git <command> [<revision>...] -- [<file>...]'
This hint: information is excellent. There needs to be a way to show it on demand.
$ git rev-parse --disambiguate=b2e1 b2e11962c5e6a9c81aa712c751c83a743fd4f384 b2e11d1bb40c5f81a2f4e37b9f9a60ec7474eeab b2e163272c01aca4aee4684f5c683ba341c1953d b2e18954c03ff502053cb74d142faab7d2a8dacb b2e1895ca92ec2037349d88b945ba64ebf16d62d
Not nearly so helpful, but the operation of --disambiguate cannot be changed without breaking current scripts.
Can your excellent "hint:" output above be attached to the -- disambiguate option somehow, please. Something like this perhaps:
$ git rev-parse --disambiguate-list=b2e1 b2e1196 tag v2.8.0-rc1 b2e11d1 tree b2e1632 commit 2007-11-14 - Merge branch 'bs/maint-commit-options' b2e1759 blob b2e18954 blob b2e1895c blob
Any option name will do, --disambiguate-verbose, --disambiguate- extended, --disambiguate-long, --disambiguate-log, --disambiguate- help, --disambiguate-show-me-something-useful-to-humans-not-scripts ...
--Kyle