mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
The command was renamed from "View worktree options" to "New worktree", but its keybinding config key was still 'worktrees.viewWorktreeOptions'. That name no longer matches the command, and the 'worktrees' section made little sense: it held a single binding that isn't even used in the worktrees panel (that panel uses universal.new), only in the branches, remotes, tags, commits, and stash panels. Other keybinding sections are named after the panel they're local to; this one wasn't local to any. Move it to universal.newWorktree, which describes the action and drops the spurious section, and migrate existing configs automatically. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
56 lines
1.5 KiB
Go
56 lines
1.5 KiB
Go
package worktree
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var AddFromBranchDetached = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Add a detached worktree at a branch via the branches view, choosing a custom location",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.NewBranch("mybranch")
|
|
shell.CreateFileAndAdd("README.md", "hello world")
|
|
shell.Commit("initial commit")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Branches().
|
|
Focus().
|
|
Lines(
|
|
Contains("mybranch"),
|
|
).
|
|
Press(keys.Universal.NewWorktree).
|
|
Tap(func() {
|
|
t.ExpectPopup().Menu().
|
|
Title(Equals("New worktree")).
|
|
Select(Contains("New detached worktree at 'mybranch'")).
|
|
Confirm()
|
|
|
|
// the location menu defaults the directory name to the branch
|
|
// name; pick "Other…" to type a different path instead
|
|
t.ExpectPopup().Menu().
|
|
Title(Equals("Worktree location")).
|
|
Select(Contains("Other…")).
|
|
Confirm()
|
|
|
|
t.ExpectPopup().Prompt().
|
|
Title(Equals("New worktree path")).
|
|
InitialText(Contains("mybranch")).
|
|
Clear().
|
|
Type("../linked-worktree").
|
|
Confirm()
|
|
}).
|
|
// confirm we're still focused on the branches view
|
|
IsFocused().
|
|
Lines(
|
|
Contains("(no branch)").IsSelected(),
|
|
Contains("mybranch (worktree repo)"),
|
|
)
|
|
|
|
t.Views().Status().
|
|
Content(Contains("repo(linked-worktree)"))
|
|
},
|
|
})
|