author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 24 Feb 2008 08:07:31 +0000 (03:07 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 24 Feb 2008 18:01:24 +0000 (10:01 -0800) | ||
commit | 2c33f7575452f53382dcf77fdc88a2ea5d46f09d | |
tree | e6a91b0bfe39674c794641f07ca2dd1b6c4c8b4e | tree | snapshot |
parent | 8a5a1884e93564cb1f46a73184d083a5181d573b | commit | diff |
Teach git-describe --exact-match to avoid expensive tag searches
Sometimes scripts want (or need) the annotated tag name that exactly
matches a specific commit, or no tag at all. In such cases it can be
difficult to determine if the output of `git describe $commit` is a
real tag name or a tag+abbreviated commit. A common idiom is to run
git-describe twice:
if test $(git describe $commit) = $(git describe --abbrev=0 $commit)
...
but this is a huge waste of time if the caller is just going to pick a
different method to describe $commit or abort because it is not exactly
an annotated tag.
Setting the maximum number of candidates to 0 allows the caller to ask
for only a tag that directly points at the supplied commit, or to have
git-describe abort if no such item exists.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sometimes scripts want (or need) the annotated tag name that exactly
matches a specific commit, or no tag at all. In such cases it can be
difficult to determine if the output of `git describe $commit` is a
real tag name or a tag+abbreviated commit. A common idiom is to run
git-describe twice:
if test $(git describe $commit) = $(git describe --abbrev=0 $commit)
...
but this is a huge waste of time if the caller is just going to pick a
different method to describe $commit or abort because it is not exactly
an annotated tag.
Setting the maximum number of candidates to 0 allows the caller to ask
for only a tag that directly points at the supplied commit, or to have
git-describe abort if no such item exists.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-describe.txt | diff | blob | history | |
builtin-describe.c | diff | blob | history |