Skip to content

Commit b86a99d

Browse files
authored
branch select: untracked branches are on their own (revert #590) (#597)
Putting untracked branches under main takes away knowledge that they are untracked in the branch selection prompt. Reverts #590
1 parent c854feb commit b86a99d

File tree

6 files changed

+24
-32
lines changed

6 files changed

+24
-32
lines changed

.changes/unreleased/Changed-20250222-094533.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

branch.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,9 @@ func (p *branchPrompter) Prompt(ctx context.Context, req *branchPromptRequest) (
135135
bases := make(map[string]string) // branch -> base
136136
for _, branch := range localBranches {
137137
res, err := p.store.LookupBranch(ctx, branch.Name)
138-
var base string
139138
if err == nil {
140-
base = res.Base
141-
} else if branch.Name != trunk {
142-
base = trunk
139+
bases[branch.Name] = res.Base
143140
}
144-
145-
bases[branch.Name] = base
146141
}
147142

148143
items := make([]widget.BranchTreeItem, 0, len(localBranches))

testdata/script/branch_checkout_prompt.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,24 @@ whatever
7474
"bar"
7575
===
7676
> Select a branch to checkout:
77+
> baz
7778
> ┏━□ bar
78-
> ┣━□ baz
7979
> ┣━□ foo
80-
> ┣━□ quux
81-
> ┣━□ qux
8280
> main ◀
81+
> quux
82+
> qux
8383
"baz"
8484
===
8585
> Do you want to track this branch now?: [Y/n]
8686
true
8787
===
8888
> Select a branch to checkout:
89+
> baz
8990
> ┏━□ bar
90-
> ┣━□ baz
9191
> ┣━□ foo
92-
> ┣━□ quux
93-
> ┣━□ qux
9492
> main ◀
93+
> quux
94+
> qux
9595
"baz"
9696
===
9797
> Do you want to track this branch now?: [Y/n]

testdata/script/branch_checkout_prompt_sort_order.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,28 @@ whatever
7373
-- robot.golden --
7474
===
7575
> Select a branch to checkout:
76+
> bcd
77+
> ccc
78+
> ddd
7679
> ┏━□ aaa
7780
> ┣━□ bbb
78-
> ┣━□ bcd
79-
> ┣━□ ccc
80-
> ┣━□ ddd
8181
> main ◀
8282
"bbb"
8383
===
8484
> Select a branch to checkout:
8585
> ┏━□ aaa
86-
> ┣━□ ccc
8786
> ┣━□ bbb
88-
> ┣━□ ddd
89-
> ┣━□ bcd
9087
> main ◀
88+
> ccc
89+
> ddd
90+
> bcd
9191
"aaa"
9292
===
9393
> Select a branch to checkout:
94-
> ┏━□ bcd
95-
> ┣━□ ddd
96-
> ┣━□ bbb
97-
> ━□ ccc
94+
> bcd
95+
> ddd
96+
> ccc
97+
> ━□ bbb
9898
> ┣━□ aaa
9999
> main ◀
100100
"bbb"

testdata/script/branch_delete_prompt_sort_order.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ whatever
6363
-- robot.golden --
6464
===
6565
> Select a branch to delete:
66-
> ┏━■ aaa ◀
66+
> ccc ◀
67+
> ┏━□ aaa
6768
> ┣━□ bbb
68-
> ┣━□ ccc
6969
> main
7070
"ccc"
7171
===
7272
> Select a branch to delete:
7373
> ┏━■ bbb ◀
74-
> ┣━□ ccc
7574
> ┣━□ aaa
7675
> main
76+
> ccc
7777
"bbb"

testdata/script/branch_delete_prompt_untracked.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ cmp stderr $WORK/stderr.golden
2626
-- robot.golden --
2727
===
2828
> Select a branch to delete:
29-
> ┏━□ a
30-
> ┣━□ b
31-
> ┣━■ c ◀
32-
> ┣━□ d
29+
> a
30+
> b
31+
> c ◀
32+
> d
3333
> main
3434
true
3535
-- stderr.golden --

0 commit comments

Comments
 (0)