path: root/Documentation
diff options
authorShawn O. Pearce <>2008-02-24 08:07:31 (GMT)
committerJunio C Hamano <>2008-02-24 18:01:24 (GMT)
commit2c33f7575452f53382dcf77fdc88a2ea5d46f09d (patch)
treee6a91b0bfe39674c794641f07ca2dd1b6c4c8b4e /Documentation
parent8a5a1884e93564cb1f46a73184d083a5181d573b (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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation')
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 1c3dfb4..fbb40a2 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -45,6 +45,11 @@ OPTIONS
candidates to describe the input committish consider
up to <n> candidates. Increasing <n> above 10 will take
slightly longer but may produce a more accurate result.
+ An <n> of 0 will cause only exact matches to be output.
+ Only output exact matches (a tag directly references the
+ supplied commit). This is a synonym for --candidates=0.
Verbosely display information about the searching strategy