aboutsummaryrefslogtreecommitdiffstats
path: root/internal/build/env.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-21 19:44:42 +0800
committerFelix Lange <fjl@twurst.com>2016-11-23 17:40:22 +0800
commite1e2df656a46c428bfb487e5ec3d126905ff003e (patch)
tree7b363803a560cafb668b2bbfa47dfcae5684936d /internal/build/env.go
parent92959cd4ef1369bc5338169d209945bb5be6b53b (diff)
downloadgo-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.gz
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.bz2
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.lz
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.xz
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.zst
go-tangerine-e1e2df656a46c428bfb487e5ec3d126905ff003e.zip
internal/build: add support for git tag in local Environment
I didn't add this initially because the command I tried was too slow. The 'git for-each-ref ...' invocation takes 40ms on my machine. That ought to be acceptable.
Diffstat (limited to 'internal/build/env.go')
-rw-r--r--internal/build/env.go5
1 files changed, 3 insertions, 2 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
}