rev-parse: --abbrev-ref option to shorten ref name

This applies the shorten_unambiguous_ref function to the object name.
Default mode is controlled by core.warnAmbiguousRefs. Else it is given as
optional argument to --abbrev-ref={strict|loose}.

This should be faster than 'git for-each-ref --format="%(refname:short)" <ref>'
for single refs.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Bert Wesarg
2009-04-13 13:20:26 +02:00
committed by Junio C Hamano
parent 2bb98169be
commit a45d34691e
2 changed files with 26 additions and 2 deletions

View File

@ -84,6 +84,11 @@ OPTIONS
unfortunately named tag "master"), and show them as full
refnames (e.g. "refs/heads/master").
--abbrev-ref[={strict|loose}]::
A non-ambiguous short name of the objects name.
The option core.warnAmbiguousRefs is used to select the strict
abbreviation mode.
--all::
Show all refs found in `$GIT_DIR/refs`.