Skip to content

Commit

Permalink
more git ignore stuff in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Dec 30, 2022
1 parent 31bdd27 commit 8a1c763
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 86 deletions.
39 changes: 0 additions & 39 deletions pkg/integration/tests/file/exclude_gitignore.go

This file was deleted.

63 changes: 63 additions & 0 deletions pkg/integration/tests/file/gitignore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package file

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var GitIgnore = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that we can't ignore the .gitignore file, then ignore/exclude other files",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".gitignore", "")
shell.CreateFile("toExclude", "")
shell.CreateFile("toIgnore", "")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains(`?? .gitignore`).IsSelected(),
Contains(`?? toExclude`),
Contains(`?? toIgnore`),
).
Press(keys.Files.IgnoreFile).
// ensure we can't exclude the .gitignore file
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("ignore or exclude file")).Select(Contains("add to .git/info/exclude")).Confirm()

t.ExpectPopup().Alert().Title(Equals("Error")).Content(Equals("Cannot exclude .gitignore")).Confirm()
}).
Press(keys.Files.IgnoreFile).
// ensure we can't ignore the .gitignore file
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("ignore or exclude file")).Select(Contains("add to .gitignore")).Confirm()

t.ExpectPopup().Alert().Title(Equals("Error")).Content(Equals("Cannot ignore .gitignore")).Confirm()

t.FileSystem().FileContent(".gitignore", Equals(""))
t.FileSystem().FileContent(".git/info/exclude", DoesNotContain(".gitignore"))
}).
SelectNextItem().
Press(keys.Files.IgnoreFile).
// exclude a file
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("ignore or exclude file")).Select(Contains("add to .git/info/exclude")).Confirm()

t.FileSystem().FileContent(".gitignore", Equals(""))
t.FileSystem().FileContent(".git/info/exclude", Contains("toExclude"))
}).
SelectNextItem().
Press(keys.Files.IgnoreFile).
// ignore a file
Tap(func() {
t.ExpectPopup().Menu().Title(Equals("ignore or exclude file")).Select(Contains("add to .gitignore")).Confirm()

t.FileSystem().FileContent(".gitignore", Equals("toIgnore\n"))
t.FileSystem().FileContent(".git/info/exclude", Contains("toExclude"))
})
},
})
2 changes: 1 addition & 1 deletion pkg/integration/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var tests = []*components.IntegrationTest{
file.DirWithUntrackedFile,
file.DiscardChanges,
file.DiscardStagedChanges,
file.ExcludeGitignore,
file.GitIgnore,
interactive_rebase.AmendMerge,
interactive_rebase.One,
stash.Rename,
Expand Down

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion test/integration/excludeMenu/expected/repo/.git_keep/HEAD

This file was deleted.

10 changes: 0 additions & 10 deletions test/integration/excludeMenu/expected/repo/.git_keep/config

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/excludeMenu/expected/repo/myfile1

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/excludeMenu/recording.json

This file was deleted.

15 changes: 0 additions & 15 deletions test/integration/excludeMenu/setup.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/integration/excludeMenu/test.json

This file was deleted.

0 comments on commit 8a1c763

Please sign in to comment.