mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-13 16:23:32 -04:00
Add a test showing that nuking the working tree can stash changes in other repositories
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bcbc5ebd6d
commit
a159e24919
@@ -0,0 +1,75 @@
|
||||
package submodule
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var IgnoreSuspiciousPath = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Ignore a submodule whose path in .gitmodules leads outside the repository",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
// Two unrelated repos next to ours, each with an uncommitted change
|
||||
for _, otherRepo := range []string{"other_repo", "linked_repo"} {
|
||||
shell.Chdir("..")
|
||||
shell.CreateDir(otherRepo)
|
||||
shell.Chdir(otherRepo)
|
||||
shell.Init()
|
||||
shell.CreateFileAndAdd("file", "original")
|
||||
shell.Commit("initial commit")
|
||||
shell.UpdateFile("file", "modified")
|
||||
shell.Chdir("../repo")
|
||||
}
|
||||
|
||||
shell.EmptyCommit("first commit")
|
||||
shell.RunCommand([]string{"ln", "-s", "../linked_repo", "link"})
|
||||
shell.GitAdd("link")
|
||||
shell.CreateFileAndAdd(".gitmodules", `[submodule "other"]
|
||||
path = ../other_repo
|
||||
url = ../other_repo
|
||||
[submodule "linked"]
|
||||
path = link
|
||||
url = ../linked_repo
|
||||
`)
|
||||
shell.Commit("add submodules")
|
||||
shell.CreateFile("untracked", "content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Submodules().
|
||||
/* EXPECTED:
|
||||
IsEmpty()
|
||||
ACTUAL: */
|
||||
Lines(
|
||||
Contains("other"),
|
||||
Contains("linked"),
|
||||
)
|
||||
|
||||
t.Views().Files().Focus().
|
||||
Lines(
|
||||
Contains("untracked"),
|
||||
).
|
||||
Press(keys.Files.ViewResetOptions).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("")).
|
||||
Select(Contains("Nuke working tree")).
|
||||
Confirm()
|
||||
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Nuke working tree")).
|
||||
Content(AnyString()).
|
||||
Confirm()
|
||||
}).
|
||||
IsEmpty()
|
||||
|
||||
t.FileSystem().
|
||||
/* EXPECTED:
|
||||
FileContent("../other_repo/file", Equals("modified")).
|
||||
FileContent("../linked_repo/file", Equals("modified"))
|
||||
ACTUAL: */
|
||||
FileContent("../other_repo/file", Equals("original")).
|
||||
FileContent("../linked_repo/file", Equals("original"))
|
||||
},
|
||||
})
|
||||
@@ -579,6 +579,7 @@ var tests = []*components.IntegrationTest{
|
||||
submodule.EnterFromDotfileBareRepo,
|
||||
submodule.EnterNested,
|
||||
submodule.IgnoreSuspiciousName,
|
||||
submodule.IgnoreSuspiciousPath,
|
||||
submodule.Remove,
|
||||
submodule.RemoveInLinkedWorktree,
|
||||
submodule.RemoveNested,
|
||||
|
||||
Reference in New Issue
Block a user