mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
Paths added to ignore/exclude files need to be prefixed with a forward slash to point to a specific file in the directory tree. Without that prefix a file at root called `file` (added to `.gitignore` as `file`) would match with `./file` and `./src/file`.
67 lines
1.7 KiB
Go
67 lines
1.7 KiB
Go
package file
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var GitignoreSpecialCharacters = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Ignore files with special characters in their names",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {
|
|
},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.CreateFile(".gitignore", "")
|
|
shell.CreateFile("#file", "")
|
|
shell.CreateFile("file#abc", "")
|
|
shell.CreateFile("!file", "")
|
|
shell.CreateFile("file!abc", "")
|
|
shell.CreateFile("abc*def", "")
|
|
shell.CreateFile("abc_def", "")
|
|
shell.CreateFile("file[x]", "")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
excludeFile := func(fileName string) {
|
|
t.Views().Files().
|
|
NavigateToLine(Contains(fileName)).
|
|
Press(keys.Files.IgnoreFile)
|
|
|
|
t.ExpectPopup().Menu().
|
|
Title(Equals("Ignore or exclude file")).
|
|
Select(Contains("Add to .gitignore")).
|
|
Confirm()
|
|
}
|
|
|
|
t.Views().Files().
|
|
Focus().
|
|
Lines(
|
|
Equals("▼ /"),
|
|
Equals(" ?? !file"),
|
|
Equals(" ?? #file"),
|
|
Equals(" ?? .gitignore"),
|
|
Equals(" ?? abc*def"),
|
|
Equals(" ?? abc_def"),
|
|
Equals(" ?? file!abc"),
|
|
Equals(" ?? file#abc"),
|
|
Equals(" ?? file[x]"),
|
|
)
|
|
|
|
excludeFile("#file")
|
|
excludeFile("file#abc")
|
|
excludeFile("!file")
|
|
excludeFile("file!abc")
|
|
excludeFile("abc*def")
|
|
excludeFile("file[x]")
|
|
|
|
t.Views().Files().
|
|
Lines(
|
|
Equals("▼ /"),
|
|
Equals(" ?? .gitignore"),
|
|
Equals(" ?? abc_def"),
|
|
)
|
|
|
|
t.FileSystem().FileContent(".gitignore", Equals("/\\#file\n/file#abc\n/\\!file\n/file!abc\n/abc\\*def\n/file\\[x\\]\n"))
|
|
},
|
|
})
|