mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
migrate ignore gitignore integration test
This commit is contained in:
parent
f2d0f362d4
commit
5e9a897348
18 changed files with 40 additions and 44 deletions
39
pkg/integration/tests/file/exclude_gitignore.go
Normal file
39
pkg/integration/tests/file/exclude_gitignore.go
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ExcludeGitignore = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Failed attempt at excluding and ignoring the .gitignore file",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateFile(".gitignore", "")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Files().
|
||||||
|
IsFocused().
|
||||||
|
Lines(
|
||||||
|
Contains(`?? .gitignore`).IsSelected(),
|
||||||
|
).
|
||||||
|
Press(keys.Files.IgnoreFile).
|
||||||
|
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).
|
||||||
|
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().FileContainsContent(".gitignore", Equals(""))
|
||||||
|
t.FileSystem().FileContainsContent(".git/info/exclude", DoesNotContain(".gitignore"))
|
||||||
|
},
|
||||||
|
})
|
|
@ -54,6 +54,7 @@ var tests = []*components.IntegrationTest{
|
||||||
file.DirWithUntrackedFile,
|
file.DirWithUntrackedFile,
|
||||||
file.DiscardChanges,
|
file.DiscardChanges,
|
||||||
file.DiscardStagedChanges,
|
file.DiscardStagedChanges,
|
||||||
|
file.ExcludeGitignore,
|
||||||
interactive_rebase.AmendMerge,
|
interactive_rebase.AmendMerge,
|
||||||
interactive_rebase.One,
|
interactive_rebase.One,
|
||||||
stash.Rename,
|
stash.Rename,
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Initial commit
|
|
|
@ -1 +0,0 @@
|
||||||
ref: refs/heads/master
|
|
|
@ -1,10 +0,0 @@
|
||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
ignorecase = true
|
|
||||||
precomposeunicode = true
|
|
||||||
[user]
|
|
||||||
email = CI@example.com
|
|
||||||
name = CI
|
|
|
@ -1 +0,0 @@
|
||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
Binary file not shown.
|
@ -1,7 +0,0 @@
|
||||||
# git ls-files --others --exclude-from=.git/info/exclude
|
|
||||||
# Lines that start with '#' are comments.
|
|
||||||
# For a project mostly in C, the following would be a good set of
|
|
||||||
# exclude patterns (uncomment them if you want to use them):
|
|
||||||
# *.[oa]
|
|
||||||
# *~
|
|
||||||
.DS_Store
|
|
|
@ -1 +0,0 @@
|
||||||
0000000000000000000000000000000000000000 e976bc07c8784964cf239ac9fbdc3535df55269c CI <CI@example.com> 1657012812 +1000 commit (initial): Initial commit
|
|
|
@ -1 +0,0 @@
|
||||||
0000000000000000000000000000000000000000 e976bc07c8784964cf239ac9fbdc3535df55269c CI <CI@example.com> 1657012812 +1000 commit (initial): Initial commit
|
|
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
e976bc07c8784964cf239ac9fbdc3535df55269c
|
|
|
@ -1 +0,0 @@
|
||||||
test1
|
|
|
@ -1 +0,0 @@
|
||||||
{"KeyEvents":[{"Timestamp":642,"Mod":0,"Key":256,"Ch":105},{"Timestamp":1529,"Mod":0,"Key":256,"Ch":101},{"Timestamp":2522,"Mod":0,"Key":27,"Ch":0},{"Timestamp":2962,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":238,"Height":61}]}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd $1
|
|
||||||
|
|
||||||
git init
|
|
||||||
|
|
||||||
git config user.email "CI@example.com"
|
|
||||||
git config user.name "CI"
|
|
||||||
|
|
||||||
git commit --allow-empty -m "Initial commit"
|
|
||||||
|
|
||||||
echo test1 > .gitignore
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"description": "In this test we attempt to add .gitignore to .git/info/exclude to ensure lazygit rejects the action",
|
|
||||||
"speed": 5
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue