diff options
24 files changed, 68 insertions, 0 deletions
diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index db9e13b78..af247550b 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -17,6 +17,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ }, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.StashCount(0) + assert.WorkingTreeFileCount(1) input.PressKeys(keys.Files.ViewStashOptions) assert.InMenu() @@ -26,5 +27,6 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.StashCount(1) + assert.WorkingTreeFileCount(0) }, }) diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go new file mode 100644 index 000000000..4ed7957ac --- /dev/null +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -0,0 +1,33 @@ +package stash + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stashing all files including untracked ones", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.CreateFile("file_1", "content") + shell.CreateFile("file_2", "content") + shell.GitAdd("file_1") + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + assert.StashCount(0) + assert.WorkingTreeFileCount(2) + + input.PressKeys(keys.Files.ViewStashOptions) + assert.InMenu() + + input.PressKeys("U") + input.Type("stash name") + input.Confirm() + + assert.StashCount(1) + assert.WorkingTreeFileCount(0) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index fd42f0ed6..028e990ee 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -29,6 +29,7 @@ var tests = []*components.IntegrationTest{ custom_commands.MultiplePrompts, custom_commands.MenuFromCommand, stash.Stash, + stash.StashIncludingUntrackedFiles, } func GetTests() []*components.IntegrationTest { diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..802607664 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +initial commit diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/FETCH_HEAD diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/HEAD b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/ORIG_HEAD b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..4ee40e25d --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/config b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/config new file mode 100644 index 000000000..8a748ce32 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/config @@ -0,0 +1,12 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[commit] + gpgSign = false diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/description b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/index b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/index Binary files differnew file mode 100644 index 000000000..65d675154 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/index diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/info/exclude b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/info/exclude new file mode 100644 index 000000000..a5196d1be --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/info/exclude @@ -0,0 +1,6 @@ +# 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] +# *~ diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/HEAD b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/HEAD new file mode 100644 index 000000000..e8dcfb6d1 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/HEAD @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105632 -0230 commit (initial): initial commit +d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105633 -0230 reset: moving to HEAD diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..df042a3dd --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105632 -0230 commit (initial): initial commit diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/stash b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/stash new file mode 100644 index 000000000..335d6aab8 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/stash @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 b8eb39e727d4ac91542d57faa0bea0458c2d30e3 CI <CI@example.com> 1665105633 -0230 On master: stash name diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/18/77c1658e50742642146b3bbb24c6b8635c7b64 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/18/77c1658e50742642146b3bbb24c6b8635c7b64 Binary files differnew file mode 100644 index 000000000..c5ff32d89 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/18/77c1658e50742642146b3bbb24c6b8635c7b64 diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 Binary files differnew file mode 100644 index 000000000..adf64119a --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea Binary files differnew file mode 100644 index 000000000..ec9764eae --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/9d/49589525f6c37d177a53a57d82603a22de6076 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/9d/49589525f6c37d177a53a57d82603a22de6076 Binary files differnew file mode 100644 index 000000000..99fe3e9e5 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/9d/49589525f6c37d177a53a57d82603a22de6076 diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 new file mode 100644 index 000000000..eb6b19046 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 @@ -0,0 +1,2 @@ +xMJ1`}\@#"¬f* +#;Ƿ7wx1nT-"F9R:S(T2cdMr锸R╠aŜC[N"TK1M¹0q'ŔpL Ň)K>Kj*3A°ϼm\a2Ҷ0FF{yz?!_1帹UY`
\ No newline at end of file diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f Binary files differnew file mode 100644 index 000000000..d412fdb69 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/dd/e611c48bd5d6df4157b99f524929851b07eca9 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/dd/e611c48bd5d6df4157b99f524929851b07eca9 Binary files differnew file mode 100644 index 000000000..1721a0ff4 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/dd/e611c48bd5d6df4157b99f524929851b07eca9 diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 new file mode 100644 index 000000000..8cc3c848b --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 @@ -0,0 +1,2 @@ +x] +0})J~7A}16o6|C@pjsޓBIo5Z,&RҖ04|B+ўuqajBtJ:4R)zOcm[PW(q+%M[:
\ No newline at end of file diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/heads/master b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/heads/master new file mode 100644 index 000000000..4ee40e25d --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/heads/master @@ -0,0 +1 @@ +d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/stash b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/stash new file mode 100644 index 000000000..3e0f2a550 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/stash @@ -0,0 +1 @@ +b8eb39e727d4ac91542d57faa0bea0458c2d30e3 |