mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add a test that demonstrates the problem
Using the "Add to .git/info/exclude" in a worktree results in an error message, as the test shows. The same would happen in a submodule, but I'm not adding an extra test for that, as the circumstances are the same.
This commit is contained in:
parent
42ebf1947a
commit
de52a68b53
2 changed files with 47 additions and 0 deletions
|
@ -308,6 +308,7 @@ var tests = []*components.IntegrationTest{
|
|||
worktree.DetachWorktreeFromBranch,
|
||||
worktree.DotfileBareRepo,
|
||||
worktree.DoubleNestedLinkedSubmodule,
|
||||
worktree.ExcludeFileInWorktree,
|
||||
worktree.FastForwardWorktreeBranch,
|
||||
worktree.ForceRemoveWorktree,
|
||||
worktree.RemoveWorktreeFromBranch,
|
||||
|
|
46
pkg/integration/tests/worktree/exclude_file_in_worktree.go
Normal file
46
pkg/integration/tests/worktree/exclude_file_in_worktree.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package worktree
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var ExcludeFileInWorktree = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Add a file to .git/info/exclude in a worktree",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("commit1")
|
||||
shell.AddWorktree("HEAD", "../linked-worktree", "mybranch")
|
||||
shell.CreateFile("../linked-worktree/toExclude", "")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Worktrees().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("repo (main)").IsSelected(),
|
||||
Contains("linked-worktree"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("toExclude"),
|
||||
).
|
||||
Press(keys.Files.IgnoreFile).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm()
|
||||
}).
|
||||
/* EXPECTED:
|
||||
IsEmpty()
|
||||
|
||||
t.FileSystem().FileContent("../repo/.git/info/exclude", Contains("toExclude"))
|
||||
ACTUAL: */
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("open .git/info/exclude: not a directory"))
|
||||
})
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue