aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-10-03 16:34:28 +0800
committerGitHub <noreply@github.com>2016-10-03 16:34:28 +0800
commitab7adb0027dbcf09cf75a533be356c1e24c46c90 (patch)
treedcf737c02d0e5b92ac04d1a387cbdc51b3bc5516
parentc683e4aaa27c5f63ebecae6eada883933d26d063 (diff)
parentb4b5921dd030568717d33b03739d65c3aeb9d9af (diff)
downloaddexon-ab7adb0027dbcf09cf75a533be356c1e24c46c90.tar.gz
dexon-ab7adb0027dbcf09cf75a533be356c1e24c46c90.tar.zst
dexon-ab7adb0027dbcf09cf75a533be356c1e24c46c90.zip
Merge pull request #3073 from fjl/build-git17
internal/build: use less edgy command to get the branch name
-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.