aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-10-03 16:22:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-10-03 16:36:03 +0800
commitee58202f2f442c9ad54658f536bf3cbecc8a1f3a (patch)
treef5df0630869d82e56bec5064b65113d97e372c15
parent9315bc9c3c8b837b5d36a0d57874df45c6319db6 (diff)
downloadgo-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar.gz
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar.bz2
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar.lz
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar.xz
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.tar.zst
go-tangerine-ee58202f2f442c9ad54658f536bf3cbecc8a1f3a.zip
[release/1.4.15] internal/build: use less edgy command to get the branch name
(cherry picked from commit b4b5921dd030568717d33b03739d65c3aeb9d9af)
-rw-r--r--internal/build/env.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/build/env.go b/internal/build/env.go
index 87b4c57ac..3f63239ca 100644
--- a/internal/build/env.go
+++ b/internal/build/env.go
@@ -84,7 +84,9 @@ func LocalEnv() Environment {
env.Commit = RunGit("rev-parse", "HEAD")
}
if env.Branch == "" {
- env.Branch = RunGit("symbolic-ref", "-q", "--short", "HEAD")
+ if b := RunGit("rev-parse", "--abbrev-ref", "HEAD"); b != "HEAD" {
+ env.Branch = b
+ }
}
// Note that we don't get the current git tag. It would slow down
// builds and isn't used by anything.