ref-filter: add new "describe" atom

Duplicate the logic of %(describe) and friends from pretty to
ref-filter. In the future, this change helps in unifying both the
formats as ref-filter will be able to do everything that pretty is doing
and we can have a single interface.

The new atom "describe" and its friends are equivalent to the existing
pretty formats with the same name.

Helped-by: Junio C Hamano <gitster@pobox.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Kousik Sanagavarapu
2023-07-23 21:49:59 +05:30
committed by Junio C Hamano
parent f46094a5e6
commit f5d18f8c0e
3 changed files with 286 additions and 0 deletions

View File

@ -258,6 +258,29 @@ ahead-behind:<committish>::
commits ahead and behind, respectively, when comparing the output
ref to the `<committish>` specified in the format.
describe[:options]::
A human-readable name, like linkgit:git-describe[1];
empty string for undescribable commits. The `describe` string may
be followed by a colon and one or more comma-separated options.
+
--
tags=<bool-value>;;
Instead of only considering annotated tags, consider
lightweight tags as well; see the corresponding option in
linkgit:git-describe[1] for details.
abbrev=<number>;;
Use at least <number> hexadecimal digits; see the corresponding
option in linkgit:git-describe[1] for details.
match=<pattern>;;
Only consider tags matching the given `glob(7)` pattern,
excluding the "refs/tags/" prefix; see the corresponding option
in linkgit:git-describe[1] for details.
exclude=<pattern>;;
Do not consider tags matching the given `glob(7)` pattern,
excluding the "refs/tags/" prefix; see the corresponding option
in linkgit:git-describe[1] for details.
--
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
be used to specify the value in the header field.