1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-08 22:52:12 +02:00

Rename AddFileInWorktree to AddFileInWorktreeOrSubmodule

It works for submodules too.

Also, pass file name and file content explicitly; the existing tests don't care
about these, but when writing tests that do, it makes them easier to understand.
This commit is contained in:
Stefan Haller
2025-10-05 14:23:05 +02:00
parent 97762f484f
commit 5b9331f42c
4 changed files with 6 additions and 6 deletions

View File

@@ -428,11 +428,11 @@ func (self *Shell) AddWorktreeCheckout(base string, path string) *Shell {
})
}
func (self *Shell) AddFileInWorktree(worktreePath string) *Shell {
self.CreateFile(filepath.Join(worktreePath, "content"), "content")
func (self *Shell) AddFileInWorktreeOrSubmodule(worktreePath string, filePath string, content string) *Shell {
self.CreateFile(filepath.Join(worktreePath, filePath), content)
self.RunCommand([]string{
"git", "-C", worktreePath, "add", "content",
"git", "-C", worktreePath, "add", filePath,
})
return self

View File

@@ -17,7 +17,7 @@ var ForceRemoveWorktree = NewIntegrationTest(NewIntegrationTestArgs{
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktree("../linked-worktree")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().

View File

@@ -17,7 +17,7 @@ var RemoveWorktreeFromBranch = NewIntegrationTest(NewIntegrationTestArgs{
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktree("../linked-worktree")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().

View File

@@ -24,7 +24,7 @@ var ResetWindowTabs = NewIntegrationTest(NewIntegrationTestArgs{
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
shell.AddFileInWorktree("../linked-worktree")
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// focus the remotes tab i.e. the second tab in the branches window