diff options
| author | Filippo Valsorda <hi@filippo.io> | 2021-10-29 17:05:32 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-04-06 16:32:06 +0000 |
| commit | 9dad70dcb7f1b857480364eb02b54f4c9378d9fa (patch) | |
| tree | f0ef30fa290a5aff164208a039b3e88d1c621de5 /git-codereview/branch.go | |
| parent | 8c1fa9c3b8ad0c79f9cefba3bdd8afde5d569f38 (diff) | |
| download | go-x-review-9dad70dcb7f1b857480364eb02b54f4c9378d9fa.tar.xz | |
git-codereview: handle branches checked out in a worktree
Change-Id: I085f1d27e9d109a81bc40603b98ebf0d827dfd66
Reviewed-on: https://go-review.googlesource.com/c/review/+/359814
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'git-codereview/branch.go')
| -rw-r--r-- | git-codereview/branch.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-codereview/branch.go b/git-codereview/branch.go index 37da5fa..c9b21a0 100644 --- a/git-codereview/branch.go +++ b/git-codereview/branch.go @@ -402,6 +402,10 @@ func LocalBranches() []*Branch { // (git rev-parse --abbrev-ref HEAD returns 'HEAD'). s = current.Name } + // + marks a branch checked out in a worktree. Worktrees in detached + // HEAD mode don't appear in the "git branch" output, so this is always + // a normal name. + s = strings.TrimPrefix(s, "+ ") branches = append(branches, &Branch{Name: s}) } return branches |
