Skip to content

Commit

Permalink
improve error message when a tag is not found and match is set
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Mar 13, 2024
1 parent b42dbb7 commit 292c18f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/versioningit/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ def describe_git_core(
distance = int(repo.read("rev-list", "--count", "HEAD")) - 1
rev = description
else:
raise NoTagError("`git describe` could not find a tag")
if len(opts.match):
msg = f"`git describe` could not find a tag matching {opts.match}"

Check warning on line 350 in src/versioningit/git.py

View check run for this annotation

Codecov / codecov/patch

src/versioningit/git.py#L350

Added line #L350 was not covered by tests
else:
msg = "git describe` could not find a tag"
raise NoTagError(msg)

Check warning on line 353 in src/versioningit/git.py

View check run for this annotation

Codecov / codecov/patch

src/versioningit/git.py#L352-L353

Added lines #L352 - L353 were not covered by tests
if distance and dirty:
state = "distance-dirty"
elif distance:
Expand Down

0 comments on commit 292c18f

Please sign in to comment.