aboutsummaryrefslogtreecommitdiffstats
path: root/internal/build/env.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-28 01:40:28 +0800
committerFelix Lange <fjl@twurst.com>2016-11-28 01:42:48 +0800
commit20899c05a4c87e3cc13b0153db4f0c3919daaa2a (patch)
treef8f78bc64cf33f4f94f0473f15cf89ba5754b035 /internal/build/env.go
parent4c8c5e2f7410d850ee6068b46c8b880f733743d4 (diff)
downloaddexon-20899c05a4c87e3cc13b0153db4f0c3919daaa2a.tar.gz
dexon-20899c05a4c87e3cc13b0153db4f0c3919daaa2a.tar.zst
dexon-20899c05a4c87e3cc13b0153db4f0c3919daaa2a.zip
internal/build: use 'git tag --points-at' to get the current tag
This should restore support for building with git 1.x.
Diffstat (limited to 'internal/build/env.go')
-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")