aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.