Skip to content

Commit 3985b2c

Browse files
committed
fix: default detected annotation and check CreateAndCheckout error
- Add default case in `formatNode` so detected nodes with any confidence level (including zero value) always show "(detected)" - Check `CreateAndCheckout` error in `TestRevListCount`
1 parent 744fc7f commit 3985b2c

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

internal/git/git_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,9 @@ func TestRevListCount(t *testing.T) {
796796
trunk, _ := g.CurrentBranch()
797797

798798
// Create feature branch with 3 commits
799-
g.CreateAndCheckout("feature")
799+
if err := g.CreateAndCheckout("feature"); err != nil {
800+
t.Fatalf("CreateAndCheckout(feature): %v", err)
801+
}
800802
for i := range 3 {
801803
fname := filepath.Join(dir, fmt.Sprintf("file%d.txt", i))
802804
if err := os.WriteFile(fname, fmt.Appendf(nil, "content%d", i), 0644); err != nil {

internal/tree/tree.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ func formatNode(sb *strings.Builder, node *Node, prefix string, isLast bool, opt
181181
detectedInfo := ""
182182
if node.Detected {
183183
switch node.Confidence {
184-
case ConfidenceMedium:
185-
detectedInfo = " (detected)"
186-
case ConfidenceAmbiguous:
187-
detectedInfo = " (detected, ambiguous)"
188184
case ConfidenceHigh:
189185
detectedInfo = " (detected, via PR)"
186+
case ConfidenceAmbiguous:
187+
detectedInfo = " (detected, ambiguous)"
188+
default:
189+
detectedInfo = " (detected)"
190190
}
191191
if opts.Style != nil {
192192
detectedInfo = opts.Style.Muted(detectedInfo)

0 commit comments

Comments
 (0)