Skip to content

Commit ee58202

Browse files
fjlkaralabe
authored andcommitted
[release/1.4.15] internal/build: use less edgy command to get the branch name
(cherry picked from commit b4b5921)
1 parent 9315bc9 commit ee58202

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/build/env.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ func LocalEnv() Environment {
8484
env.Commit = RunGit("rev-parse", "HEAD")
8585
}
8686
if env.Branch == "" {
87-
env.Branch = RunGit("symbolic-ref", "-q", "--short", "HEAD")
87+
if b := RunGit("rev-parse", "--abbrev-ref", "HEAD"); b != "HEAD" {
88+
env.Branch = b
89+
}
8890
}
8991
// Note that we don't get the current git tag. It would slow down
9092
// builds and isn't used by anything.

0 commit comments

Comments
 (0)