Skip to content

Commit

Permalink
Use git branch --show-current because it works when there are no comm…
Browse files Browse the repository at this point in the history
…its.
  • Loading branch information
rhoboat committed Mar 18, 2021
1 parent a53c621 commit 6eb7597
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func GetCurrentBranchName(t testing.TestingT) string {
// GetCurrentBranchNameE retrieves the current branch name or
// empty string in case of detached state.
func GetCurrentBranchNameE(t testing.TestingT) (string, error) {
cmd := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD")
cmd := exec.Command("git", "branch", "--show-current")
bytes, err := cmd.Output()
if err != nil {
return "", err
Expand Down

0 comments on commit 6eb7597

Please sign in to comment.