aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-28 16:33:12 +0800
committerGitHub <noreply@github.com>2016-11-28 16:33:12 +0800
commit2b9cd71d67cd497fe2cc17a53aea2254b9178b88 (patch)
treeeb278ccd52c796b942fdca9462bee4d7f20da7a4
parent6061707371929bd51c211fbb4ab2b4c223f65544 (diff)
parent20899c05a4c87e3cc13b0153db4f0c3919daaa2a (diff)
downloaddexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar.gz
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar.bz2
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar.lz
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar.xz
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.tar.zst
dexon-2b9cd71d67cd497fe2cc17a53aea2254b9178b88.zip
Merge pull request #3352 from fjl/build-git-tag
internal/build: use 'git tag --points-at' to get the current tag
-rw-r--r--internal/build/env.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/build/env.go b/internal/build/env.go
index 95281df86..15b2dfe41 100644
--- a/internal/build/env.go
+++ b/internal/build/env.go
@@ -20,6 +20,7 @@ import (
"flag"
"fmt"
"os"
+ "strings"
)
var (
@@ -89,11 +90,15 @@ func LocalEnv() Environment {
}
}
if env.Tag == "" {
- env.Tag = RunGit("for-each-ref", "--points-at=HEAD", "--count=1", "--format=%(refname:short)", "refs/tags")
+ env.Tag = firstLine(RunGit("tag", "-l", "--points-at", "HEAD"))
}
return env
}
+func firstLine(s string) string {
+ return strings.Split(s, "\n")[0]
+}
+
func applyEnvFlags(env Environment) Environment {
if !flag.Parsed() {
panic("you need to call flag.Parse before Env or LocalEnv")