C.15 GitDescribeTask

This task finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit.

Table C.16: Attributes

gitPathStringPath to Git binary/usr/bin/gitNo
repositoryStringPath to Git repositoryn/aYes
outputPropertyStringProperty name to set with output value from git-describe.n/aNo
allBooleanInstead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching any known branch, remote-tracking branch, or lightweight tag.falseNo
tagsStringInstead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching a lightweight (non-annotated) tag.falseNo
containsBooleanInstead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it. Automatically implies --tags.falseNo
longBooleanAlways output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag.falseNo
alwaysBooleanShow uniquely abbreviated commit object as fallback.falseNo
abbrevIntegerInstead of using the default 7 hexadecimal digits as the abbreviated object name, use n digits, or as many digits as needed to form a unique object name. An n of 0 will suppress long format, only showing the closest tag.n/aNo
matchStringOnly consider tags matching the given glob(7) pattern, excluding the "refs/tags/" prefix. This can be used to avoid leaking private tags from the repository.n/aNo
committishStringCommit-ish object names to describe. Defaults to HEAD if omitted.HEADNo
canditatesIntegerInstead of considering only the 10 most recent tags as candidates to describe the input commit-ish 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.n/aNo

C.15.1 Example

<gitdescribe repository="${repo.dir}"
    outputProperty="mostRecentTag" />