Skip to content

Commit 21483b2

Browse files
committed
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.
1 parent 8e00bbd commit 21483b2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

pkg/integration/components/shell.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ func (self *Shell) AddWorktreeCheckout(base string, path string) *Shell {
428428
})
429429
}
430430

431-
func (self *Shell) AddFileInWorktree(worktreePath string) *Shell {
432-
self.CreateFile(filepath.Join(worktreePath, "content"), "content")
431+
func (self *Shell) AddFileInWorktreeOrSubmodule(worktreePath string, filePath string, content string) *Shell {
432+
self.CreateFile(filepath.Join(worktreePath, filePath), content)
433433

434434
self.RunCommand([]string{
435-
"git", "-C", worktreePath, "add", "content",
435+
"git", "-C", worktreePath, "add", filePath,
436436
})
437437

438438
return self

pkg/integration/tests/worktree/force_remove_worktree.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var ForceRemoveWorktree = NewIntegrationTest(NewIntegrationTestArgs{
1717
shell.EmptyCommit("commit 2")
1818
shell.EmptyCommit("commit 3")
1919
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
20-
shell.AddFileInWorktree("../linked-worktree")
20+
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
2121
},
2222
Run: func(t *TestDriver, keys config.KeybindingConfig) {
2323
t.Views().Worktrees().

pkg/integration/tests/worktree/remove_worktree_from_branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var RemoveWorktreeFromBranch = NewIntegrationTest(NewIntegrationTestArgs{
1717
shell.EmptyCommit("commit 2")
1818
shell.EmptyCommit("commit 3")
1919
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
20-
shell.AddFileInWorktree("../linked-worktree")
20+
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
2121
},
2222
Run: func(t *TestDriver, keys config.KeybindingConfig) {
2323
t.Views().Branches().

pkg/integration/tests/worktree/reset_window_tabs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var ResetWindowTabs = NewIntegrationTest(NewIntegrationTestArgs{
2424
shell.EmptyCommit("commit 2")
2525
shell.EmptyCommit("commit 3")
2626
shell.AddWorktree("mybranch", "../linked-worktree", "newbranch")
27-
shell.AddFileInWorktree("../linked-worktree")
27+
shell.AddFileInWorktreeOrSubmodule("../linked-worktree", "file", "content")
2828
},
2929
Run: func(t *TestDriver, keys config.KeybindingConfig) {
3030
// focus the remotes tab i.e. the second tab in the branches window

0 commit comments

Comments
 (0)