Skip to content

Commit 2c6dc32

Browse files
authored
Set version as release when there are no commits ahead (zyedidia#3515)
Print release version tag in tools/build-version.go even if the commit being checked has a tag that is not a version number if there are no commits ahead.
1 parent 3cb8069 commit 2c6dc32

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/build-version.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ func main() {
4747
fmt.Println("0.0.0-unknown")
4848
return
4949
}
50-
// Get the tag of the current revision.
51-
tag, _ := getTag("--exact-match")
52-
if tag == versionStr {
50+
if ahead == nil {
5351
// Seems that we are going to build a release.
5452
// So the version number should already be correct.
5553
fmt.Println(version.String())
5654
return
5755
}
5856

57+
// Get the tag of the current revision.
58+
tag, _ := getTag("--exact-match")
59+
5960
// If we don't have any tag assume "dev"
6061
if tag == "" || strings.HasPrefix(tag, "nightly") {
6162
tag = "dev"
@@ -72,10 +73,8 @@ func main() {
7273
log.Printf("semver.NewPRVersion(%s): %v", tag, err)
7374
}
7475

75-
if ahead != nil {
76-
// if we know how many commits we are ahead of the last release, append that too.
77-
version.Pre = append(version.Pre, *ahead)
78-
}
76+
// append how many commits we are ahead of the last release
77+
version.Pre = append(version.Pre, *ahead)
7978

8079
fmt.Println(version.String())
8180
}

0 commit comments

Comments
 (0)