Skip to content

Commit ab7adb0

Browse files
authored
Merge pull request bnb-chain#3073 from fjl/build-git17
internal/build: use less edgy command to get the branch name
2 parents c683e4a + b4b5921 commit ab7adb0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎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)