diff --git a/README.md b/README.md index 9320c7c..987e44e 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,8 @@ Highlight a branch or worktree and press `c` to mark or unmark it as part of the Once at least one item is marked, a hint line appears below the list telling you which key acts on the marked set. Press `D` to delete every marked branch: a confirmation screen lists the branches (and worktree paths, where applicable) about to be removed, `Enter` runs the deletion (`git worktree remove` for items with a worktree, then `git branch -d` for each), and any cancel key (`Esc`, `Ctrl-C`, `q`) backs out without touching Git state or losing your marked selection. +If any marked branch has unmerged changes, confirming does not delete anything yet — `git branch -d` would refuse it anyway. Instead a second screen lists the unmerged branch(es) and requires you to type the exact phrase `Yes, I want to remove the branch that has changes that have been unmerged.` and press `Enter` before the whole batch (merged and unmerged branches alike) is deleted, force-deleting only the unmerged ones (`git branch -D`). `Esc`/`Ctrl-C` cancels the entire batch and returns to the list without touching Git state. + The picker uses color to distinguish the selected row, current worktree, marked items, worktree tags, locked worktrees, and filter prompt. Pass `--no-color` to disable all ANSI styling. Selecting a worktree changes your shell's directory to it. Selecting a plain branch with no worktree prompts you to either switch to it in place or create a new worktree for it: diff --git a/SPEC.md b/SPEC.md index 65acddc..035a7e5 100644 --- a/SPEC.md +++ b/SPEC.md @@ -88,6 +88,41 @@ Selecting a plain branch with no worktree and confirming prompts one extra line: ``` This directly resolves the stated pain point: instead of `git switch` erroring out, the tool offers the two valid resolutions inline. +**Deleting branches with unmerged changes:** `git branch -d` (the non-force +delete `wt` uses) refuses branches not fully merged, so by default such a +branch is simply left in place. `wt` detects this ahead of time — each +`Item` carries an `Unmerged` flag computed from `git branch --merged` during +collection — and if any branch in the marked set is unmerged, confirming the +normal delete screen (`D` then `Enter`) does not delete anything yet. +Instead a second screen appears: + +``` +The following branch(es) have unmerged changes and will be permanently lost: + feature/wip-thing +Type the phrase below exactly and press Enter to proceed, or Esc to cancel: + +Yes, I want to remove the branch that has changes that have been unmerged. + +> _ +``` + +- This screen only appears when at least one marked branch is unmerged; + marked sets containing only merged branches delete exactly as before, + with no extra step. +- The user must type the phrase **"Yes, I want to remove the branch that has + changes that have been unmerged."** exactly (case-sensitive, full + punctuation) and press `Enter` to proceed; any mismatch is rejected and + the input stays open for correction. `Esc` or `Ctrl-C` cancels the whole + batch — including any merged branches marked alongside the unmerged + one(s) — and returns to the list without touching Git state or losing + the marked selection. +- Once confirmed, `wt` deletes the batch in one pass: merged branches via + `git branch -d` as before, unmerged branches via `git branch -D` (force), + since explicit, phrase-level consent was already obtained. +- Detached-HEAD worktree entries (which have no associated branch to + delete) are excluded from the unmerged check and never trigger this + screen on their own. + ## 5. Implementation Details **Command-line arguments:** diff --git a/integration_test.go b/integration_test.go index af7e8d4..a7574ed 100644 --- a/integration_test.go +++ b/integration_test.go @@ -274,6 +274,56 @@ func TestIntegrationDeleteMarkedBranchWithoutWorktree(t *testing.T) { } } +func TestIntegrationDeleteUnmergedBranchRequiresForcePhrase(t *testing.T) { + repo := t.TempDir() + initRepo(t, repo) + runGit(t, repo, "branch", "wip") + runGit(t, repo, "checkout", "wip") + runGit(t, repo, "commit", "--allow-empty", "-m", "unmerged work") + runGit(t, repo, "checkout", "main") + chdir(t, repo) + + items, err := gitdata.Collect() + if err != nil { + t.Fatalf("gitdata.Collect: %v", err) + } + top, err := gitdata.Toplevel() + if err != nil { + t.Fatalf("gitdata.Toplevel: %v", err) + } + + var wip *gitdata.Item + for i := range items { + if items[i].Branch == "wip" { + wip = &items[i] + } + } + if wip == nil || !wip.Unmerged { + t.Fatalf("items = %+v, want a wip branch marked Unmerged", items) + } + + // order: main (cursor 0), wip (cursor 1) -> down, mark, D, Enter (opens + // the force-delete phrase prompt), type the required phrase, Enter. + keys := []tea.KeyMsg{keyDown, keyRune('c'), keyRune('D'), keyEnter} + for _, r := range ui.ForceDeleteConfirmPhrase { + keys = append(keys, keyRune(r)) + } + keys = append(keys, keyEnter) + + m := ui.New(items, top, "", true) + result := drivePicker(t, m, keys...) + + if len(result.Delete) != 1 || result.Delete[0].Branch != "wip" { + t.Fatalf("result.Delete = %+v, want [wip]", result.Delete) + } + applyResult(t, result) + + branches := runGit(t, repo, "branch", "--list", "wip") + if strings.TrimSpace(branches) != "" { + t.Fatalf("branch wip still exists after force delete: %q", branches) + } +} + func worktreePathForBranch(t *testing.T, repo, branch string) string { t.Helper() out := runGit(t, repo, "worktree", "list", "--porcelain") diff --git a/internal/action/action.go b/internal/action/action.go index a9eecdd..3f27bb6 100644 --- a/internal/action/action.go +++ b/internal/action/action.go @@ -55,11 +55,13 @@ func newWorktreeWith(run runnerFunc, path, branch string) (string, error) { } // DeleteWorktrees removes each item's worktree, if it has one, via -// `git worktree remove`, then deletes the branch via `git branch -d` -// (non-force: a branch with unmerged commits is left in place and reported -// as an error). Items without a worktree skip straight to the branch -// delete. Every item is attempted even if earlier ones fail; all failures -// are combined into a single returned error. +// `git worktree remove`, then deletes the branch via `git branch -d`, or +// `git branch -D` (force) when item.Unmerged is set. Callers must only pass +// Unmerged items after the user has given explicit, phrase-typed consent +// (see internal/ui's modeConfirmForceDelete) — this function performs no +// confirmation of its own. Items without a worktree skip straight to the +// branch delete. Every item is attempted even if earlier ones fail; all +// failures are combined into a single returned error. func DeleteWorktrees(items []gitdata.Item) error { return deleteWorktreesWith(runGit, items) } @@ -84,7 +86,11 @@ func deleteWorktreesWith(run runnerFunc, items []gitdata.Item) error { if item.Detached { continue } - if err := run("branch", "-d", item.Branch); err != nil { + deleteFlag := "-d" + if item.Unmerged { + deleteFlag = "-D" + } + if err := run("branch", deleteFlag, item.Branch); err != nil { errs = append(errs, fmt.Errorf("%s: %w", item.Branch, err)) } } diff --git a/internal/action/action_test.go b/internal/action/action_test.go index 27cb07d..ba430ac 100644 --- a/internal/action/action_test.go +++ b/internal/action/action_test.go @@ -79,6 +79,27 @@ func TestDeleteWorktreesWithRemovesWorktreeThenDeletesBranch(t *testing.T) { } } +func TestDeleteWorktreesWithForcesDeleteOfUnmergedBranch(t *testing.T) { + run, calls := recordingRunner() + items := []gitdata.Item{ + {Branch: "feature/wip", Path: "/repo/proj-wip", Unmerged: true}, + {Branch: "release/2.1", Path: "/repo/proj-release"}, + } + + if err := deleteWorktreesWith(run, items); err != nil { + t.Fatalf("deleteWorktreesWith() error = %v", err) + } + want := [][]string{ + {"worktree", "remove", "/repo/proj-wip"}, + {"branch", "-D", "feature/wip"}, + {"worktree", "remove", "/repo/proj-release"}, + {"branch", "-d", "release/2.1"}, + } + if !reflect.DeepEqual(*calls, want) { + t.Fatalf("git calls = %v, want %v", *calls, want) + } +} + func TestDeleteWorktreesWithBranchWithoutWorktreeSkipsWorktreeRemove(t *testing.T) { run, calls := recordingRunner() item := gitdata.Item{Branch: "bugfix/api-timeout"} diff --git a/internal/gitdata/gitdata.go b/internal/gitdata/gitdata.go index 2588726..4bff5a1 100644 --- a/internal/gitdata/gitdata.go +++ b/internal/gitdata/gitdata.go @@ -24,6 +24,7 @@ type Item struct { IsCurrent bool Locked bool Detached bool + Unmerged bool // true if the branch is not fully merged into HEAD (git branch -d would refuse it) } // HasWorktree reports whether the branch is checked out anywhere. @@ -99,6 +100,15 @@ func collect(run runnerFunc) ([]Item, error) { } branches := parseLines(brOut) + mergedOut, err := run("branch", "--format=%(refname:short)", "--merged") + if err != nil { + return nil, err + } + merged := make(map[string]bool, len(branches)) + for _, b := range parseLines(mergedOut) { + merged[b] = true + } + top, err := toplevel(run) if err != nil { return nil, err @@ -106,7 +116,7 @@ func collect(run runnerFunc) ([]Item, error) { items := make([]Item, 0, len(branches)+len(worktrees)) for _, b := range branches { - item := Item{Branch: b} + item := Item{Branch: b, Unmerged: !merged[b]} if w, ok := byBranch[b]; ok { item.Path = w.path item.Locked = w.locked diff --git a/internal/gitdata/gitdata_test.go b/internal/gitdata/gitdata_test.go index 3e233cb..c2a412e 100644 --- a/internal/gitdata/gitdata_test.go +++ b/internal/gitdata/gitdata_test.go @@ -76,11 +76,12 @@ func TestParseLines(t *testing.T) { } } -// fakeRunner returns canned output per git subcommand, keyed by the first arg. +// fakeRunner returns canned output per full git invocation, keyed by the +// space-joined args (e.g. "branch --format=%(refname:short) --merged"). type fakeRunner map[string]string func (f fakeRunner) run(args ...string) (string, error) { - out, ok := f[args[0]] + out, ok := f[strings.Join(args, " ")] if !ok { return "", fmt.Errorf("unexpected git subcommand: %v", args) } @@ -89,7 +90,7 @@ func (f fakeRunner) run(args ...string) (string, error) { func TestCollectMergesBranchesAndWorktrees(t *testing.T) { fr := fakeRunner{ - "worktree": strings.Join([]string{ + "worktree list --porcelain -z": strings.Join([]string{ "worktree /repo/proj", "HEAD abc123", "branch refs/heads/main", @@ -108,8 +109,9 @@ func TestCollectMergesBranchesAndWorktrees(t *testing.T) { "detached", "", }, "\x00"), - "branch": "main\nfeature/login\nbugfix/api-timeout\nrelease/2.1\n", - "rev-parse": "/repo/proj\n", + "branch --list --format=%(refname:short)": "main\nfeature/login\nbugfix/api-timeout\nrelease/2.1\n", + "branch --format=%(refname:short) --merged": "main\nbugfix/api-timeout\n", + "rev-parse --show-toplevel": "/repo/proj\n", } items, err := collect(fr.run) @@ -119,9 +121,9 @@ func TestCollectMergesBranchesAndWorktrees(t *testing.T) { want := []Item{ {Branch: "main", Path: "/repo/proj", IsCurrent: true}, - {Branch: "feature/login", Path: "/repo/proj-login"}, + {Branch: "feature/login", Path: "/repo/proj-login", Unmerged: true}, {Branch: "bugfix/api-timeout"}, - {Branch: "release/2.1", Path: "/repo/proj-release", Locked: true}, + {Branch: "release/2.1", Path: "/repo/proj-release", Locked: true, Unmerged: true}, {Branch: "(detached)", Path: "/repo/proj-scratch", Detached: true}, } if !reflect.DeepEqual(items, want) { @@ -131,9 +133,10 @@ func TestCollectMergesBranchesAndWorktrees(t *testing.T) { func TestCollectMovesCurrentItemFirst(t *testing.T) { fr := fakeRunner{ - "worktree": "worktree /repo/proj\x00HEAD abc123\x00branch refs/heads/z-current\x00", - "branch": "a-first\nz-current\n", - "rev-parse": "/repo/proj\n", + "worktree list --porcelain -z": "worktree /repo/proj\x00HEAD abc123\x00branch refs/heads/z-current\x00", + "branch --list --format=%(refname:short)": "a-first\nz-current\n", + "branch --format=%(refname:short) --merged": "a-first\nz-current\n", + "rev-parse --show-toplevel": "/repo/proj\n", } items, err := collect(fr.run) if err != nil { @@ -146,7 +149,7 @@ func TestCollectMovesCurrentItemFirst(t *testing.T) { func TestCollectMovesCurrentFirstPreservingRemainingOrder(t *testing.T) { fr := fakeRunner{ - "worktree": strings.Join([]string{ + "worktree list --porcelain -z": strings.Join([]string{ "worktree /repo/proj-current", "HEAD abc123", "branch refs/heads/z-current", @@ -156,8 +159,9 @@ func TestCollectMovesCurrentFirstPreservingRemainingOrder(t *testing.T) { "detached", "", }, "\x00"), - "branch": "a-first\nb-middle\nz-current\n", - "rev-parse": "/repo/proj-current\n", + "branch --list --format=%(refname:short)": "a-first\nb-middle\nz-current\n", + "branch --format=%(refname:short) --merged": "a-first\nb-middle\nz-current\n", + "rev-parse --show-toplevel": "/repo/proj-current\n", } items, err := collect(fr.run) @@ -176,6 +180,28 @@ func TestCollectMovesCurrentFirstPreservingRemainingOrder(t *testing.T) { } } +func TestCollectMarksUnmergedBranches(t *testing.T) { + fr := fakeRunner{ + "worktree list --porcelain -z": "", + "branch --list --format=%(refname:short)": "main\nfeature/wip\n", + "branch --format=%(refname:short) --merged": "main\n", + "rev-parse --show-toplevel": "/repo/proj\n", + } + + items, err := collect(fr.run) + if err != nil { + t.Fatalf("collect() error = %v", err) + } + + want := []Item{ + {Branch: "main"}, + {Branch: "feature/wip", Unmerged: true}, + } + if !reflect.DeepEqual(items, want) { + t.Fatalf("collect() = %#v, want %#v", items, want) + } +} + func TestParseWorktreePorcelainPreservesSpecialPath(t *testing.T) { out := "worktree /repo/café folder\\name\x00HEAD abc123\x00detached\x00\x00" got := parseWorktreePorcelain(out) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index 43734b8..6c59340 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -25,8 +25,15 @@ const ( modeLocked modeHelp modeConfirmDelete + modeConfirmForceDelete ) +// ForceDeleteConfirmPhrase is the exact text a user must type to delete a +// branch with unmerged changes. It must match verbatim (case-sensitive, +// including punctuation) — this is deliberate friction against losing +// unmerged work, so it is never abbreviated or made configurable. +const ForceDeleteConfirmPhrase = "Yes, I want to remove the branch that has changes that have been unmerged." + // Result is what the picker produced when the program exited. type Result struct { Cancelled bool @@ -51,6 +58,8 @@ type Model struct { keymap string height int + forceConfirmInput string // typed phrase in modeConfirmForceDelete + result Result quitting bool } @@ -107,28 +116,81 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m.updateLocked(keyMsg) case modeConfirmDelete: return m.updateConfirmDelete(keyMsg) + case modeConfirmForceDelete: + return m.updateConfirmForceDelete(keyMsg) default: return m.updateList(keyMsg) } } // updateConfirmDelete handles the approval step shown after pressing D with -// at least one branch marked. Enter confirms and quits with the marked -// items in Result.Delete; any cancel key stops the operation and returns to -// the list without quitting the picker. +// at least one branch marked. Enter confirms: if any marked branch is +// unmerged, it advances to modeConfirmForceDelete for an explicit +// phrase-typed confirmation instead of quitting immediately. Any cancel key +// stops the operation and returns to the list without quitting the picker. func (m Model) updateConfirmDelete(msg tea.KeyMsg) (tea.Model, tea.Cmd) { if isCancel(msg) { m.mode = modeList return m, nil } if msg.Type == tea.KeyEnter { - m.result = Result{Delete: m.Marked()} + marked := m.Marked() + if hasUnmergedBranch(marked) { + m.forceConfirmInput = "" + m.mode = modeConfirmForceDelete + return m, nil + } + m.result = Result{Delete: marked} m.quitting = true return m, tea.Quit } return m, nil } +// updateConfirmForceDelete handles the phrase-typed approval step shown +// when at least one marked branch has unmerged changes. Esc/Ctrl-C cancel +// back to the list; Enter only confirms and quits (with the full marked set +// in Result.Delete) when the typed text matches ForceDeleteConfirmPhrase +// exactly, otherwise it is a no-op so the user can keep correcting the +// input. "q" is not treated as cancel here since it is valid input text. +func (m Model) updateConfirmForceDelete(msg tea.KeyMsg) (tea.Model, tea.Cmd) { + switch msg.Type { + case tea.KeyEsc, tea.KeyCtrlC: + m.forceConfirmInput = "" + m.mode = modeList + return m, nil + case tea.KeyEnter: + if m.forceConfirmInput == ForceDeleteConfirmPhrase { + m.result = Result{Delete: m.Marked()} + m.quitting = true + return m, tea.Quit + } + return m, nil + case tea.KeyBackspace: + if len(m.forceConfirmInput) > 0 { + r := []rune(m.forceConfirmInput) + m.forceConfirmInput = string(r[:len(r)-1]) + } + return m, nil + case tea.KeyRunes: + m.forceConfirmInput += string(msg.Runes) + return m, nil + } + return m, nil +} + +// hasUnmergedBranch reports whether any item has unmerged changes on its +// branch. Detached-HEAD entries have no associated branch to delete, so +// they are excluded regardless of their zero-value Unmerged field. +func hasUnmergedBranch(items []gitdata.Item) bool { + for _, item := range items { + if item.Unmerged && !item.Detached { + return true + } + } + return false +} + func (m Model) updateLocked(msg tea.KeyMsg) (tea.Model, tea.Cmd) { if isCancel(msg) { m.mode = modeList @@ -460,6 +522,17 @@ func (m Model) View() string { } b.WriteString("[Enter] confirm [Esc] cancel\n") return b.String() + case modeConfirmForceDelete: + b.WriteString("The following branch(es) have unmerged changes and will be permanently lost:\n") + for _, item := range m.Marked() { + if item.Unmerged && !item.Detached { + fmt.Fprintf(&b, " %s\n", item.Branch) + } + } + b.WriteString("Type the phrase below exactly and press Enter to proceed, or Esc to cancel:\n\n") + fmt.Fprintf(&b, " %s\n\n", ForceDeleteConfirmPhrase) + fmt.Fprintf(&b, "> %s\n", m.forceConfirmInput) + return b.String() } if m.mode == modeFilter { @@ -575,7 +648,7 @@ func (m Model) helpView() string { " top/bottom : g / G", " filter : / (Esc clears)", " mark : c (selection)", - " delete : D (marked branches, asks to confirm)", + " delete : D (marked branches, asks to confirm; unmerged branches require typing a phrase)", " confirm : Enter", " cancel : Esc, Ctrl-C, q", " help : ?", diff --git a/internal/ui/ui_test.go b/internal/ui/ui_test.go index 2866f22..adfa299 100644 --- a/internal/ui/ui_test.go +++ b/internal/ui/ui_test.go @@ -381,6 +381,110 @@ func TestConfirmDeleteViewShowsNoWorktreeForPlainBranch(t *testing.T) { } } +func TestConfirmDeleteEnterWithUnmergedItemEntersForceDeleteMode(t *testing.T) { + items := testItems() + items[1].Unmerged = true // feature/login + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('D'), keyType(tea.KeyEnter)) + if m.mode != modeConfirmForceDelete { + t.Fatalf("mode after confirming delete with an unmerged branch = %v, want modeConfirmForceDelete", m.mode) + } + if m.quitting { + t.Fatal("Enter in modeConfirmDelete with an unmerged branch should not quit yet") + } +} + +func TestForceDeleteViewListsOnlyUnmergedBranchesFromMixedBatch(t *testing.T) { + items := testItems() + items[3].Locked = false + items[1].Unmerged = true // feature/login unmerged; release/2.1 stays merged + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('j'), key('j'), key('c'), key('D'), keyType(tea.KeyEnter)) + view := m.View() + if !strings.Contains(view, "feature/login") { + t.Fatalf("force-delete view missing unmerged branch:\n%s", view) + } + if strings.Contains(view, "release/2.1") { + t.Fatalf("force-delete view should not list merged branch release/2.1:\n%s", view) + } + if !strings.Contains(view, ForceDeleteConfirmPhrase) { + t.Fatalf("force-delete view missing required phrase:\n%s", view) + } +} + +func TestForceDeleteWrongPhraseDoesNotQuit(t *testing.T) { + items := testItems() + items[1].Unmerged = true + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('D'), keyType(tea.KeyEnter), key('y'), key('e'), key('s'), keyType(tea.KeyEnter)) + if m.mode != modeConfirmForceDelete || m.quitting { + t.Fatalf("mismatched phrase should not confirm: mode=%v quitting=%v", m.mode, m.quitting) + } +} + +func TestForceDeleteBackspaceEditsInput(t *testing.T) { + items := testItems() + items[1].Unmerged = true + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('D'), keyType(tea.KeyEnter), key('y'), key('e'), key('s'), keyType(tea.KeyBackspace)) + if m.forceConfirmInput != "ye" { + t.Fatalf("forceConfirmInput after backspace = %q, want %q", m.forceConfirmInput, "ye") + } +} + +func TestForceDeleteEscCancelsWithoutQuittingAndClearsInput(t *testing.T) { + items := testItems() + items[1].Unmerged = true + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('D'), keyType(tea.KeyEnter), key('y'), keyType(tea.KeyEsc)) + if m.mode != modeList { + t.Fatalf("mode after Esc in modeConfirmForceDelete = %v, want modeList", m.mode) + } + if m.quitting { + t.Fatal("Esc in modeConfirmForceDelete should not quit the program") + } + if len(m.Marked()) != 1 { + t.Fatalf("Marked() after cancelling force-delete = %+v, want [feature/login] (cancel should not clear marks)", m.Marked()) + } + if m.forceConfirmInput != "" { + t.Fatalf("forceConfirmInput after cancel = %q, want empty", m.forceConfirmInput) + } +} + +func TestForceDeleteExactPhraseQuitsWithMarkedItems(t *testing.T) { + items := testItems() + items[1].Unmerged = true + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('D'), keyType(tea.KeyEnter)) + for _, r := range ForceDeleteConfirmPhrase { + m = send(t, m, key(r)) + } + m = send(t, m, keyType(tea.KeyEnter)) + if !m.quitting { + t.Fatal("Enter with the exact phrase in modeConfirmForceDelete should quit the program") + } + res := m.Result() + if len(res.Delete) != 1 || res.Delete[0].Branch != "feature/login" { + t.Fatalf("Result().Delete = %+v, want [feature/login]", res.Delete) + } +} + +func TestForceDeleteConfirmsWholeMixedBatch(t *testing.T) { + items := testItems() + items[3].Locked = false + items[1].Unmerged = true + m := New(items, "/repo/proj", "", true) + m = send(t, m, key('j'), key('c'), key('j'), key('j'), key('c'), key('D'), keyType(tea.KeyEnter)) + for _, r := range ForceDeleteConfirmPhrase { + m = send(t, m, key(r)) + } + m = send(t, m, keyType(tea.KeyEnter)) + res := m.Result() + if len(res.Delete) != 2 { + t.Fatalf("Result().Delete = %+v, want 2 items (whole marked batch, merged and unmerged)", res.Delete) + } +} + func TestHelpOverlayReturnsToList(t *testing.T) { m := New(testItems(), "/repo/proj", "", true) m = send(t, m, key('?')) @@ -400,7 +504,7 @@ func TestHelpOverlayDocumentsMarkBindingAndSemantics(t *testing.T) { if !strings.Contains(view, "mark : c (selection)") { t.Fatalf("help overlay missing mark binding:\n%s", view) } - if !strings.Contains(view, "delete : D (marked branches, asks to confirm)") { + if !strings.Contains(view, "delete : D (marked branches, asks to confirm; unmerged branches require typing a phrase)") { t.Fatalf("help overlay missing delete semantics:\n%s", view) } }