diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-11-23 18:24:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-23 18:24:28 +0800 |
commit | e05d35e6e04f1378c18861016f96b39b35cef4f2 (patch) | |
tree | 78102f23cfbba026810c2fff717f2187e5c5ca34 /internal/build | |
parent | f7da5b29f0917575850849c7fb20bcc5376ab772 (diff) | |
parent | e1e2df656a46c428bfb487e5ec3d126905ff003e (diff) | |
download | go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar.gz go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar.bz2 go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar.lz go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar.xz go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.tar.zst go-tangerine-e05d35e6e04f1378c18861016f96b39b35cef4f2.zip |
Merge pull request #3317 from fjl/build-unstable-simplify
build, internal/build: simplify unstable build checks
Diffstat (limited to 'internal/build')
-rw-r--r-- | internal/build/env.go | 5 | ||||
-rw-r--r-- | internal/build/util.go | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/internal/build/env.go b/internal/build/env.go index cd3355092..95281df86 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -88,8 +88,9 @@ func LocalEnv() Environment { env.Branch = b } } - // Note that we don't get the current git tag. It would slow down - // builds and isn't used by anything. + if env.Tag == "" { + env.Tag = RunGit("for-each-ref", "--points-at=HEAD", "--count=1", "--format=%(refname:short)", "refs/tags") + } return env } diff --git a/internal/build/util.go b/internal/build/util.go index c7e0614f2..1523a067b 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -76,6 +76,8 @@ func VERSION() string { return string(bytes.TrimSpace(version)) } +var warnedAboutGit bool + // RunGit runs a git subcommand and returns its output. // The command must complete successfully. func RunGit(args ...string) string { @@ -83,7 +85,10 @@ func RunGit(args ...string) string { var stdout, stderr bytes.Buffer cmd.Stdout, cmd.Stderr = &stdout, &stderr if err := cmd.Run(); err == exec.ErrNotFound { - log.Println("no git in PATH") + if !warnedAboutGit { + log.Println("Warning: can't find 'git' in PATH") + warnedAboutGit = true + } return "" } else if err != nil { log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr.String()) |