Skip to content

Commit

Permalink
Bugfix/version dirty tag fix (#38)
Browse files Browse the repository at this point in the history
* Version dirty check fix

* Changed dirty tag index
  • Loading branch information
francis-nijay authored Dec 8, 2021
1 parent f3f9133 commit 478e15b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/semver/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {

gitdesc := chkErr(doExec("git", "describe", "--long", "--dirty"))
rx := regexp.MustCompile(
`^[^\d]*(\d+)\.(\d+)\.(\d+)\-?(?:(-?[a-zA-Z]+))?(?:-(\d+)-g(.+?)(?:-(dirty))?)?\s*$`)
`^[^\d]*(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z].+?))?(?:-(\d+)-g(.+?)(?:-(dirty))?)?\s*$`)
m := rx.FindStringSubmatch(gitdesc)
if len(m) == 0 {
fmt.Fprintf(os.Stderr, "error: match git describe failed: %s\n", gitdesc)
Expand All @@ -128,9 +128,9 @@ func main() {
Minor: toInt(m[2]),
Patch: toInt(m[3]),
Notes: m[4],
Sha7: m[5],
Sha7: m[6],
Sha32: chkErr(doExec("git", "log", "-n1", `--format=%H`)),
Dirty: m[6] != "",
Dirty: m[7] != "",
Epoch: toInt64(chkErr(doExec("git", "log", "-n1", `--format=%ct`))),
}
ver.SemVer = ver.String()
Expand Down

0 comments on commit 478e15b

Please sign in to comment.