mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
tools/build-version.go: Remove the git fetch step
build-version.go shall only provide information and not modify the repository in which it runs.
This commit is contained in:
@@ -38,24 +38,6 @@ func getTag(match ...string) (string, *semver.PRVersion) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
tags, err := exec.Command("git", "tag").Output()
|
|
||||||
if err != nil {
|
|
||||||
log.Println("git tag:", err)
|
|
||||||
if e, ok := err.(*exec.ExitError); ok {
|
|
||||||
log.Print(string(e.Stderr))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(tags) == 0 {
|
|
||||||
// no tags found -- fetch them
|
|
||||||
err = exec.Command("git", "fetch", "--tags").Run()
|
|
||||||
if err != nil {
|
|
||||||
log.Println("git fetch --tags:", err)
|
|
||||||
if e, ok := err.(*exec.ExitError); ok {
|
|
||||||
log.Print(string(e.Stderr))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the last vX.X.X Tag and get how many builds we are ahead of it.
|
// Find the last vX.X.X Tag and get how many builds we are ahead of it.
|
||||||
versionStr, ahead := getTag("--match", "v*")
|
versionStr, ahead := getTag("--match", "v*")
|
||||||
version, err := semver.ParseTolerant(versionStr)
|
version, err := semver.ParseTolerant(versionStr)
|
||||||
|
|||||||
Reference in New Issue
Block a user