Skip to content

Commit fffbff2

Browse files
committed
docs
1 parent c9e63ea commit fffbff2

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# gitsemver
77

8-
Build a [semver](https://semver.org/) compliant version string for a git repository.
8+
Build a SemVer-inspired version string for a git repository.
99

1010
Using tree hashes it returns the latest matching semver tag. If no tree hash
1111
match exactly, it falls back to the latest semver tag reachable from the
@@ -21,6 +21,11 @@ Supports raw git repositories as well as GitLab and GitHub builders.
2121

2222
`gitsemver` is a CLI-first tool, one process run per repository.
2323

24+
Tag matching is intentionally relaxed: `vMAJOR`, `vMAJOR.MINOR`, and
25+
`vMAJOR.MINOR.PATCH` (and the same forms without `v`) are all accepted and
26+
preserved in output. If you require strict SemVer 2.0.0 output, use full
27+
`MAJOR.MINOR.PATCH` tags in Git.
28+
2429
The implementation package is intentionally internal to this module and is not a
2530
supported external API.
2631
If reused anyway, create a new `GitSemVer` instance per version lookup

internal/gitsemver/gitter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ func (dg DefaultGitter) CheckGitRepo(dir string) (repo string, err error) {
154154
return
155155
}
156156

157+
// Intentionally accepts partial numeric tags (v1, v1.2, v1.2.3),
158+
// with or without a leading "v".
157159
var reMatchSemver = regexp.MustCompile(`^v?[0-9]+(?:\.[0-9]+)?(?:\.[0-9]+)?$`)
158160

159161
// GetTags returns all tags, sorted by version descending.

0 commit comments

Comments
 (0)