1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

migrate ignore gitignore integration test

This commit is contained in:
Jesse Duffield 2022-12-28 13:35:00 +11:00
parent f2d0f362d4
commit 5e9a897348
18 changed files with 40 additions and 44 deletions

View 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"))
},
})

View File

@ -54,6 +54,7 @@ var tests = []*components.IntegrationTest{
file.DirWithUntrackedFile,
file.DiscardChanges,
file.DiscardStagedChanges,
file.ExcludeGitignore,
interactive_rebase.AmendMerge,
interactive_rebase.One,
stash.Rename,

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,10 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[user]
email = CI@example.com
name = CI

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -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

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 e976bc07c8784964cf239ac9fbdc3535df55269c CI <CI@example.com> 1657012812 +1000 commit (initial): Initial commit

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 e976bc07c8784964cf239ac9fbdc3535df55269c CI <CI@example.com> 1657012812 +1000 commit (initial): Initial commit

View File

@ -1 +0,0 @@
e976bc07c8784964cf239ac9fbdc3535df55269c

View File

@ -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}]}

View File

@ -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

View File

@ -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
}