提交 b4b5921d 编写于 作者: F Felix Lange

internal/build: use less edgy command to get the branch name

上级 c683e4aa
...@@ -84,7 +84,9 @@ func LocalEnv() Environment { ...@@ -84,7 +84,9 @@ func LocalEnv() Environment {
env.Commit = RunGit("rev-parse", "HEAD") env.Commit = RunGit("rev-parse", "HEAD")
} }
if env.Branch == "" { 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 // Note that we don't get the current git tag. It would slow down
// builds and isn't used by anything. // builds and isn't used by anything.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册