fix: correctly set ErrNotOnAnyBranch error in git client (#7082)
Before, git client was not correctly setting `ErrNotOnAnyBranch` error. Because of that, `gh pr status` was not functioning correctly when run from the detached HEAD. This commit fixes that. Fixes #7051
This commit is contained in:
parent
2268d2e4eb
commit
7d4ab65af3
1 changed files with 1 additions and 0 deletions
|
|
@ -142,6 +142,7 @@ func (c *Client) CurrentBranch(ctx context.Context) (string, error) {
|
|||
if err != nil {
|
||||
var gitErr *GitError
|
||||
if ok := errors.As(err, &gitErr); ok && len(gitErr.Stderr) == 0 {
|
||||
gitErr.err = ErrNotOnAnyBranch
|
||||
gitErr.Stderr = "not on any branch"
|
||||
return "", gitErr
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue