git

Functions

jnrbase.git.find_tag(__matcher='v[0-9]*', *, strict=True, git_dir=None)[source]

Find closest tag for a git repository.

Note

This defaults to Semantic Version tag matching.

Parameters
  • __matcher (str) – Glob-style tag pattern to match

  • strict (bool) – Allow commit-ish, if no tag found

  • git_dir (Optional[Path]) – Repository to search

Return type

str

Returns

Matching tag name

Examples

>>> with tarball_data('semver') as tree:
...    find_tag(git_dir=tree)
'v2.3.4'