From 7ddb80a13eb22f8ce4fb0522397e1db1221f3876 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Fri, 3 Jun 2022 15:41:08 -0230 Subject: [PATCH 01/29] feat: add stash option to include untracked changes --- pkg/commands/git_commands/stash.go | 8 ++++++++ pkg/gui/controllers/files_controller.go | 7 +++++++ pkg/i18n/english.go | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index c0d187a13..8444032c8 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -109,3 +109,11 @@ func (self *StashCommands) SaveStagedChanges(message string) error { return nil } + +func (self *StashCommands) StashUntrackedChanges(message string) error { + if err := self.cmd.New("git stash -u").Run(); err != nil { + return err + } + return nil +} + diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 8f0b8333f..c7c189542 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -792,6 +792,13 @@ func (self *FilesController) createStashMenu() error { }, Key: 'u', }, + { + Label: self.c.Tr.LcStashIncludeUntrackedChanges, + OnPress: func() error { + return self.handleStashSave(self.git.Stash.StashUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) + }, + Key: 'U', + }, }, }) } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 608ad2f45..fe8bf3076 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -293,6 +293,7 @@ type TranslationSet struct { LcStashStagedChanges string LcStashAllChangesKeepIndex string LcStashUnstagedChanges string + LcStashIncludeUntrackedChanges string LcStashOptions string NotARepository string LcJump string @@ -584,6 +585,7 @@ type Actions struct { StashAllChangesKeepIndex string StashStagedChanges string StashUnstagedChanges string + StashIncludeUntrackedChanges string GitFlowFinish string GitFlowStart string CopyToClipboard string @@ -933,6 +935,7 @@ func EnglishTranslationSet() TranslationSet { LcStashStagedChanges: "stash staged changes", LcStashAllChangesKeepIndex: "stash all changes and keep index", LcStashUnstagedChanges: "stash unstaged changes", + LcStashIncludeUntrackedChanges: "stash all changes including untracked files", LcStashOptions: "Stash options", NotARepository: "Error: must be run inside a git repository", LcJump: "jump to panel", @@ -1207,6 +1210,7 @@ func EnglishTranslationSet() TranslationSet { StashAllChangesKeepIndex: "Stash all changes and keep index", StashStagedChanges: "Stash staged changes", StashUnstagedChanges: "Stash unstaged changes", + StashIncludeUntrackedChanges: "Stash all changes including untracked files", GitFlowFinish: "Git flow finish", GitFlowStart: "Git Flow start", CopyToClipboard: "Copy to clipboard", From c7fd2183082d33516a256d7aff3135a9b12b490a Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Fri, 3 Jun 2022 16:55:58 -0230 Subject: [PATCH 02/29] fix: add condition to if statement --- pkg/gui/controllers/files_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index c7c189542..f1dbfb51c 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -833,7 +833,7 @@ func (self *FilesController) toggleTreeView() error { } func (self *FilesController) handleStashSave(stashFunc func(message string) error, action string, errorMsg string) error { - if !self.helpers.WorkingTree.IsWorkingTreeDirty() { + if action != self.c.Tr.Actions.StashIncludeUntrackedChanges && !self.helpers.WorkingTree.IsWorkingTreeDirty() { return self.c.ErrorMsg(errorMsg) } From 088445b7bed796b0d52820680c44718e816b53fa Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Fri, 3 Jun 2022 16:56:39 -0230 Subject: [PATCH 03/29] test: add integration test --- .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 + .../expected/repo/.git_keep/FETCH_HEAD | 0 .../expected/repo/.git_keep/HEAD | 1 + .../expected/repo/.git_keep/ORIG_HEAD | 1 + .../expected/repo/.git_keep/config | 10 ++++++++++ .../expected/repo/.git_keep/description | 1 + .../expected/repo/.git_keep/index | Bin 0 -> 65 bytes .../expected/repo/.git_keep/info/exclude | 6 ++++++ .../expected/repo/.git_keep/logs/HEAD | 2 ++ .../repo/.git_keep/logs/refs/heads/master | 1 + .../expected/repo/.git_keep/logs/refs/stash | 1 + .../02/8cf118f08271dc2b9dd68d72a65918df664951 | 2 ++ .../09/767bd3484e22b41138116992cc1cb5bc45fb7f | Bin 0 -> 50 bytes .../4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | Bin 0 -> 15 bytes .../59/2d439043d07cd223cbde4b3a0884b94634437b | Bin 0 -> 123 bytes .../b3/c24805b28fa5e90b5807bb402b123974f13d61 | Bin 0 -> 219 bytes .../db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 | Bin 0 -> 166 bytes .../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | Bin 0 -> 15 bytes .../expected/repo/.git_keep/refs/heads/master | 1 + .../expected/repo/.git_keep/refs/stash | 1 + .../stashIncludeUntrackedChanges/recording.json | 1 + .../stashIncludeUntrackedChanges/setup.sh | 14 ++++++++++++++ .../stashIncludeUntrackedChanges/test.json | 1 + 23 files changed, 44 insertions(+) create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/info/exclude create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/59/2d439043d07cd223cbde4b3a0884b94634437b create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/b3/c24805b28fa5e90b5807bb402b123974f13d61 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/heads/master create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/stash create mode 100644 test/integration/stashIncludeUntrackedChanges/recording.json create mode 100644 test/integration/stashIncludeUntrackedChanges/setup.sh create mode 100644 test/integration/stashIncludeUntrackedChanges/test.json diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..5852f4463 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..a3df47f69 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +592d439043d07cd223cbde4b3a0884b94634437b diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config new file mode 100644 index 000000000..8ae104545 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config @@ -0,0 +1,10 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index new file mode 100644 index 0000000000000000000000000000000000000000..65d675154f23ffb2d0196e017d44a5e7017550f5 GIT binary patch literal 65 zcmZ?q402{*U|<4bhL9jvS0E+HV4z^Y<=qr}%;|LA&IJiiy? 1654284027 -0230 commit (initial): Initial commit +592d439043d07cd223cbde4b3a0884b94634437b 592d439043d07cd223cbde4b3a0884b94634437b CI 1654284036 -0230 reset: moving to HEAD diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..1074c856f --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 592d439043d07cd223cbde4b3a0884b94634437b CI 1654284027 -0230 commit (initial): Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash new file mode 100644 index 000000000..f33d8a619 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 b3c24805b28fa5e90b5807bb402b123974f13d61 CI 1654284036 -0230 WIP on master: 592d439 Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 new file mode 100644 index 000000000..4032664a3 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 @@ -0,0 +1,2 @@ +x[ +0E*fJ&&""HS 6)| n9R-%7@Ome:ץQoXdGt!("d;nqoϺB?=j:k7R;8K8ؗFzSy@_5`Xrq_Z|j: \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f new file mode 100644 index 0000000000000000000000000000000000000000..d09fb5ad6408a5f924793e8b825d8666b6f550a7 GIT binary patch literal 50 zcmbRj literal 0 HcmV?d00001 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000000000000000000000000000000000000..adf64119a33d7621aeeaa505d30adb58afaa5559 GIT binary patch literal 15 Wcmb0EGW|0ga783c@fD06pgw`vGOU-NXb$gr4$@B;8`5F{P~F^DX!Rufq&edTUi- zu;WR05#a2}&c!j6>?DVT4#jd_{OkgGzhn^($R@q@*>{*C+@|=DPiosLm(trE24|T( dBVFN)G@?1^F;V$bH}O@qrWJmj`2u@vFPDNGJk*mR-2D!m1;%6zYB6K65tMUD zVx5^vPJ@2$pX(MbQ+T;dZ~mk6{pL??onJ%ZOdu4I!(#-D!$FVe-T$c%AJcnSmoV$s Vv3Wk5!?axYtKP!j-7oKQUWsDma!CLH literal 0 HcmV?d00001 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 new file mode 100644 index 0000000000000000000000000000000000000000..b3d2804ffbf0463e12c63f6717af698829d11040 GIT binary patch literal 166 zcmV;X09pTd0gaA93c@fDMP26 Date: Fri, 3 Jun 2022 23:54:39 -0230 Subject: [PATCH 04/29] refactor: change command order --- pkg/gui/controllers/files_controller.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index f1dbfb51c..6e20af51a 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -770,6 +770,13 @@ func (self *FilesController) createStashMenu() error { }, Key: 'i', }, + { + Label: self.c.Tr.LcStashIncludeUntrackedChanges, + OnPress: func() error { + return self.handleStashSave(self.git.Stash.StashUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) + }, + Key: 'U', + }, { Label: self.c.Tr.LcStashStagedChanges, OnPress: func() error { @@ -792,13 +799,6 @@ func (self *FilesController) createStashMenu() error { }, Key: 'u', }, - { - Label: self.c.Tr.LcStashIncludeUntrackedChanges, - OnPress: func() error { - return self.handleStashSave(self.git.Stash.StashUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) - }, - Key: 'U', - }, }, }) } From 4f8816ebf293a57d9dbb863f18b88e73962edf3c Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Tue, 21 Jun 2022 18:13:41 -0230 Subject: [PATCH 05/29] refactor: use extended flag name --- pkg/commands/git_commands/stash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index 8444032c8..b8802911d 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -111,7 +111,7 @@ func (self *StashCommands) SaveStagedChanges(message string) error { } func (self *StashCommands) StashUntrackedChanges(message string) error { - if err := self.cmd.New("git stash -u").Run(); err != nil { + if err := self.cmd.New("git stash --include-untracked").Run(); err != nil { return err } return nil From e66b16272675ba0cb8deaa9cf741120ce9941ac9 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Tue, 21 Jun 2022 18:14:40 -0230 Subject: [PATCH 06/29] refactor: remove redundant if statement --- pkg/commands/git_commands/stash.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index b8802911d..255e7a86c 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -111,9 +111,6 @@ func (self *StashCommands) SaveStagedChanges(message string) error { } func (self *StashCommands) StashUntrackedChanges(message string) error { - if err := self.cmd.New("git stash --include-untracked").Run(); err != nil { - return err - } - return nil + return self.cmd.New("git stash --include-untracked").Run(); } From 6feb301c2a3367698ccf5f1f3f8f3e89fe806604 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Tue, 21 Jun 2022 18:23:23 -0230 Subject: [PATCH 07/29] fix: use message in git stash command --- pkg/commands/git_commands/stash.go | 2 +- .../expected/repo/.git_keep/ORIG_HEAD | 2 +- .../expected/repo/.git_keep/logs/HEAD | 4 ++-- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../expected/repo/.git_keep/logs/refs/stash | 2 +- .../02/8cf118f08271dc2b9dd68d72a65918df664951 | 2 -- .../03/158a5be423590fa91f97c23ed505745e8e8aff | Bin 0 -> 122 bytes .../29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 | 2 ++ .../59/2d439043d07cd223cbde4b3a0884b94634437b | Bin 123 -> 0 bytes .../b3/c24805b28fa5e90b5807bb402b123974f13d61 | Bin 219 -> 0 bytes .../db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 | Bin 166 -> 0 bytes .../fe/d8896ec3398ae58cfd81e56a058bf18b49427a | 2 ++ .../ff/d4134b8bf80d379824558ce19b4eddbc53e2ba | Bin 0 -> 147 bytes .../expected/repo/.git_keep/refs/heads/master | 2 +- .../expected/repo/.git_keep/refs/stash | 2 +- .../stashIncludeUntrackedChanges/recording.json | 2 +- 16 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/59/2d439043d07cd223cbde4b3a0884b94634437b delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/b3/c24805b28fa5e90b5807bb402b123974f13d61 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/fe/d8896ec3398ae58cfd81e56a058bf18b49427a create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/ff/d4134b8bf80d379824558ce19b4eddbc53e2ba diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index 255e7a86c..72b61b744 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -111,6 +111,6 @@ func (self *StashCommands) SaveStagedChanges(message string) error { } func (self *StashCommands) StashUntrackedChanges(message string) error { - return self.cmd.New("git stash --include-untracked").Run(); + return self.cmd.New(fmt.Sprintf("git stash save %s --include-untracked", self.cmd.Quote(message))).Run() } diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD index a3df47f69..a25b9571b 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD @@ -1 +1 @@ -592d439043d07cd223cbde4b3a0884b94634437b +03158a5be423590fa91f97c23ed505745e8e8aff diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD index 8daa2233e..cd44a69c6 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD @@ -1,2 +1,2 @@ -0000000000000000000000000000000000000000 592d439043d07cd223cbde4b3a0884b94634437b CI 1654284027 -0230 commit (initial): Initial commit -592d439043d07cd223cbde4b3a0884b94634437b 592d439043d07cd223cbde4b3a0884b94634437b CI 1654284036 -0230 reset: moving to HEAD +0000000000000000000000000000000000000000 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844652 -0230 commit (initial): Initial commit +03158a5be423590fa91f97c23ed505745e8e8aff 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844659 -0230 reset: moving to HEAD diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master index 1074c856f..d99532170 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 592d439043d07cd223cbde4b3a0884b94634437b CI 1654284027 -0230 commit (initial): Initial commit +0000000000000000000000000000000000000000 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844652 -0230 commit (initial): Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash index f33d8a619..2fa025e98 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash @@ -1 +1 @@ -0000000000000000000000000000000000000000 b3c24805b28fa5e90b5807bb402b123974f13d61 CI 1654284036 -0230 WIP on master: 592d439 Initial commit +0000000000000000000000000000000000000000 fed8896ec3398ae58cfd81e56a058bf18b49427a CI 1655844659 -0230 WIP on master: 03158a5 Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 deleted file mode 100644 index 4032664a3..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/02/8cf118f08271dc2b9dd68d72a65918df664951 +++ /dev/null @@ -1,2 +0,0 @@ -x[ -0E*fJ&&""HS 6)| n9R-%7@Ome:ץQoXdGt!("d;nqoϺB?=j:k7R;8K8ؗFzSy@_5`Xrq_Z|j: \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff new file mode 100644 index 0000000000000000000000000000000000000000..b4c7ec9be8564e3d6b59d0bf0c1b40525aeb724d GIT binary patch literal 122 zcmV-=0EPc}0ga783d0}}0DJZo`+<~=*;!%+~)AmZ>;Z4uesGbjKb`Q cge?qcCo~5=CSCv3O?Z`F;s$4Dett_YrD3T!n*aa+ literal 0 HcmV?d00001 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 new file mode 100644 index 000000000..635f2cc2f --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 @@ -0,0 +1,2 @@ +xA +0E]s%MgDDzI:BӔǷ >Xr*cOu -j! ɍRAQRA 9 hZ:oie$M8qw} n:%|9DKڴZ\M(;2a3|E \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/59/2d439043d07cd223cbde4b3a0884b94634437b b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/59/2d439043d07cd223cbde4b3a0884b94634437b deleted file mode 100644 index d695a40a5970daf0eb6dc0bd12b6227ede70277b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 123 zcmV->0EGW|0ga783c@fD06pgw`vGOU-NXb$gr4$@B;8`5F{P~F^DX!Rufq&edTUi- zu;WR05#a2}&c!j6>?DVT4#jd_{OkgGzhn^($R@q@*>{*C+@|=DPiosLm(trE24|T( dBVFN)G@?1^F;V$bH}O@qrWJmj`2u@vFPDNGJk*mR-2D!m1;%6zYB6K65tMUD zVx5^vPJ@2$pX(MbQ+T;dZ~mk6{pL??onJ%ZOdu4I!(#-D!$FVe-T$c%AJcnSmoV$s Vv3Wk5!?axYtKP!j-7oKQUWsDma!CLH diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/db/0f86d5434dd5e5f3a2210f9a7edf5a816ae935 deleted file mode 100644 index b3d2804ffbf0463e12c63f6717af698829d11040..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 166 zcmV;X09pTd0gaA93c@fDMP26xqyZNhJrE1q^lkS=rj^bF)d9zzD>M<+n@K|PqmcX z0G&Ivl^LY(Y!^puoMEM+LDUY>daqK#6e%V{Q|u-Y_V%nR^aI@b;lZC!-ZNiPEq6dm z Date: Tue, 21 Jun 2022 19:20:19 -0230 Subject: [PATCH 08/29] test: add stash message --- .../expected/repo/.git_keep/ORIG_HEAD | 2 +- .../expected/repo/.git_keep/logs/HEAD | 4 ++-- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../expected/repo/.git_keep/logs/refs/stash | 2 +- .../03/158a5be423590fa91f97c23ed505745e8e8aff | Bin 122 -> 0 bytes .../29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 | 2 -- .../3b/f44f88f6673290a762ccc832cf31fe74ef91f1 | Bin 0 -> 122 bytes .../4b/7be4c80e71164df70d6af8dedd4eee60fc042a | Bin 0 -> 147 bytes .../98/9eb86a55fc4942f907cceddb0c83357cf29c30 | Bin 0 -> 221 bytes .../e8/9483c44e35b3cc03c03ae56747f60ca7832f9c | 3 +++ .../fe/d8896ec3398ae58cfd81e56a058bf18b49427a | 2 -- .../ff/d4134b8bf80d379824558ce19b4eddbc53e2ba | Bin 147 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 2 +- .../expected/repo/.git_keep/refs/stash | 2 +- .../stashIncludeUntrackedChanges/recording.json | 2 +- 15 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/7be4c80e71164df70d6af8dedd4eee60fc042a create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/98/9eb86a55fc4942f907cceddb0c83357cf29c30 create mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e8/9483c44e35b3cc03c03ae56747f60ca7832f9c delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/fe/d8896ec3398ae58cfd81e56a058bf18b49427a delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/ff/d4134b8bf80d379824558ce19b4eddbc53e2ba diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD index a25b9571b..890bb1577 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD @@ -1 +1 @@ -03158a5be423590fa91f97c23ed505745e8e8aff +3bf44f88f6673290a762ccc832cf31fe74ef91f1 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD index cd44a69c6..65d0caa66 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD @@ -1,2 +1,2 @@ -0000000000000000000000000000000000000000 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844652 -0230 commit (initial): Initial commit -03158a5be423590fa91f97c23ed505745e8e8aff 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844659 -0230 reset: moving to HEAD +0000000000000000000000000000000000000000 3bf44f88f6673290a762ccc832cf31fe74ef91f1 CI 1655848119 -0230 commit (initial): Initial commit +3bf44f88f6673290a762ccc832cf31fe74ef91f1 3bf44f88f6673290a762ccc832cf31fe74ef91f1 CI 1655848130 -0230 reset: moving to HEAD diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master index d99532170..5f82957c2 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 03158a5be423590fa91f97c23ed505745e8e8aff CI 1655844652 -0230 commit (initial): Initial commit +0000000000000000000000000000000000000000 3bf44f88f6673290a762ccc832cf31fe74ef91f1 CI 1655848119 -0230 commit (initial): Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash index 2fa025e98..686bd5ddd 100644 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash @@ -1 +1 @@ -0000000000000000000000000000000000000000 fed8896ec3398ae58cfd81e56a058bf18b49427a CI 1655844659 -0230 WIP on master: 03158a5 Initial commit +0000000000000000000000000000000000000000 989eb86a55fc4942f907cceddb0c83357cf29c30 CI 1655848130 -0230 On master: stash untracked changes diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/03/158a5be423590fa91f97c23ed505745e8e8aff deleted file mode 100644 index b4c7ec9be8564e3d6b59d0bf0c1b40525aeb724d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122 zcmV-=0EPc}0ga783d0}}0DJZo`+<~=*;!%+~)AmZ>;Z4uesGbjKb`Q cge?qcCo~5=CSCv3O?Z`F;s$4Dett_YrD3T!n*aa+ diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 deleted file mode 100644 index 635f2cc2f..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/29/b079ba8e40edf7b2c76613e0a3de5b1b26ce70 +++ /dev/null @@ -1,2 +0,0 @@ -xA -0E]s%MgDDzI:BӔǷ >Xr*cOu -j! ɍRAQRA 9 hZ:oie$M8qw} n:%|9DKڴZ\M(;2a3|E \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 new file mode 100644 index 0000000000000000000000000000000000000000..e3d77a36c2934f40a247459cb93aaed03d2f596a GIT binary patch literal 122 zcmV-=0EPc}0ga783c@fD06pgw`vE0MH_HY@gr4$@B;8`5F;Z6W`4;?u*I|aKqxYuZ z!gSJI1hB9VOC|KRkd&A$SqWHHUMPCzwTNJ}X!2VhV~07xbxwEr^Qb)gmqYxO` cxd>xqya&p{2$cldgIUphF}UFfC0yzD>M<+n@K|4>jl1 z0IfZ>l^NvFcfFrASz@I;A!>`*4TA~+gEu~qiN24*?d@4t7$>-m(}O=QzZbrQn(u&} zF_tW931_La6vuj;H2xD8dugi+FP-3ff1aXkjX;CAYvYExvP{I~^TL BLP7ul literal 0 HcmV?d00001 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/98/9eb86a55fc4942f907cceddb0c83357cf29c30 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/98/9eb86a55fc4942f907cceddb0c83357cf29c30 new file mode 100644 index 0000000000000000000000000000000000000000..3d4c95f9a189097c47f7a2b3e97ca69a9dde61ab GIT binary patch literal 221 zcmV<303!c*0gaDAYQ!)MMZ3-^e1R6(R%E-BQkd1OdInjRI%S$qTIx=2COi literal 0 HcmV?d00001 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e8/9483c44e35b3cc03c03ae56747f60ca7832f9c b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e8/9483c44e35b3cc03c03ae56747f60ca7832f9c new file mode 100644 index 000000000..b1df5e4f2 --- /dev/null +++ b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e8/9483c44e35b3cc03c03ae56747f60ca7832f9c @@ -0,0 +1,3 @@ +xA +0E]s%L]I:BӖǷ >2V@SDfHL"KAbv{t.G6+ؘ[^1,lM${ +\6zuCPI.i)w04V=9W< %W<1LE \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/fe/d8896ec3398ae58cfd81e56a058bf18b49427a b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/fe/d8896ec3398ae58cfd81e56a058bf18b49427a deleted file mode 100644 index ccac20445..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/fe/d8896ec3398ae58cfd81e56a058bf18b49427a +++ /dev/null @@ -1,2 +0,0 @@ -xJ1D=WNҝEDܼyN:3|d^WE-uafj5aLY j/-q(2t z*Bj"1ta9PFbEz? -U!XYC)h אe8x:@K@RͳI綻^.rSݖW@LBHaħm[xqyZNhJrE1q^lkS=rj^bF)d9zzD>M<+n@K|PqmcX z0G&Ivl^LY(Y!^puoMEM+LDUY>daqK#6e%V{Q|u-Y_V%nR^aI@b;lZC!-ZNiPEq6dm z Date: Sun, 3 Jul 2022 19:44:07 -0230 Subject: [PATCH 09/29] refactor: rename method to `StashIncludeUntrackedChanges` --- pkg/commands/git_commands/stash.go | 2 +- pkg/gui/controllers/files_controller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index 72b61b744..40e205a67 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -110,7 +110,7 @@ func (self *StashCommands) SaveStagedChanges(message string) error { return nil } -func (self *StashCommands) StashUntrackedChanges(message string) error { +func (self *StashCommands) StashIncludeUntrackedChanges(message string) error { return self.cmd.New(fmt.Sprintf("git stash save %s --include-untracked", self.cmd.Quote(message))).Run() } diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 6e20af51a..19c296562 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -773,7 +773,7 @@ func (self *FilesController) createStashMenu() error { { Label: self.c.Tr.LcStashIncludeUntrackedChanges, OnPress: func() error { - return self.handleStashSave(self.git.Stash.StashUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.StashIncludeUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) }, Key: 'U', }, From e189546acb8f36ee1fc2f7aa23538f768054a400 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Wed, 27 Jul 2022 17:43:24 -0230 Subject: [PATCH 10/29] refactor: move checks for clean working tree --- pkg/gui/controllers/files_controller.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 19c296562..50ef448c9 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -758,6 +758,9 @@ func (self *FilesController) createStashMenu() error { { Label: self.c.Tr.LcStashAllChanges, OnPress: func() error { + if !self.helpers.WorkingTree.IsWorkingTreeDirty() { + return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) + } return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges, self.c.Tr.NoFilesToStash) }, Key: 'a', @@ -765,6 +768,9 @@ func (self *FilesController) createStashMenu() error { { Label: self.c.Tr.LcStashAllChangesKeepIndex, OnPress: func() error { + if !self.helpers.WorkingTree.IsWorkingTreeDirty() { + return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) + } // if there are no staged files it behaves the same as Stash.Save return self.handleStashSave(self.git.Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex, self.c.Tr.NoFilesToStash) }, @@ -791,6 +797,9 @@ func (self *FilesController) createStashMenu() error { { Label: self.c.Tr.LcStashUnstagedChanges, OnPress: func() error { + if !self.helpers.WorkingTree.IsWorkingTreeDirty() { + return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) + } if self.helpers.WorkingTree.AnyStagedFiles() { return self.handleStashSave(self.git.Stash.StashUnstagedChanges, self.c.Tr.Actions.StashUnstagedChanges, self.c.Tr.NoFilesToStash) } @@ -833,9 +842,6 @@ func (self *FilesController) toggleTreeView() error { } func (self *FilesController) handleStashSave(stashFunc func(message string) error, action string, errorMsg string) error { - if action != self.c.Tr.Actions.StashIncludeUntrackedChanges && !self.helpers.WorkingTree.IsWorkingTreeDirty() { - return self.c.ErrorMsg(errorMsg) - } return self.c.Prompt(types.PromptOpts{ Title: self.c.Tr.StashChanges, From db9373662a0f1f1d730c9cef556679a313875af7 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Thu, 15 Sep 2022 23:11:27 -0230 Subject: [PATCH 11/29] test: add test for basic stash --- pkg/integration/components/assert.go | 11 +++++++++++ pkg/integration/tests/stash/stash.go | 27 +++++++++++++++++++++++++++ pkg/integration/tests/tests.go | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 pkg/integration/tests/stash/stash.go diff --git a/pkg/integration/components/assert.go b/pkg/integration/components/assert.go index ae363eb8d..ec8efbf29 100644 --- a/pkg/integration/components/assert.go +++ b/pkg/integration/components/assert.go @@ -78,6 +78,17 @@ func (self *Assert) CommitCount(expectedCount int) { }) } +func (self *Assert) StashCount(expectedCount int) { + self.assertWithRetries(func() (bool, string) { + actualCount := len(self.gui.Model().StashEntries) + + return actualCount == expectedCount, fmt.Sprintf( + "Expected %d stash entries, but got %d", + expectedCount, actualCount, + ) + }) +} + func (self *Assert) MatchHeadCommitMessage(matcher *matcher) { self.assertWithRetries(func() (bool, string) { return len(self.gui.Model().Commits) > 0, "Expected at least one commit to be present" diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go new file mode 100644 index 000000000..55095e42d --- /dev/null +++ b/pkg/integration/tests/stash/stash.go @@ -0,0 +1,27 @@ +package stash + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var Stash = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stashing files", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.CreateFile("file", "content") + shell.GitAddAll() + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + assert.StashCount(0) + + input.PressKeys(keys.Files.ViewStashOptions) + input.Confirm() + input.Confirm() + + assert.StashCount(1) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 587ac8e30..fd42f0ed6 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -13,6 +13,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/commit" "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" + "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -27,6 +28,7 @@ var tests = []*components.IntegrationTest{ custom_commands.Basic, custom_commands.MultiplePrompts, custom_commands.MenuFromCommand, + stash.Stash, } func GetTests() []*components.IntegrationTest { From f4c188fa5b069a1d0714dc9508cecfa55eaddf46 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Thu, 6 Oct 2022 22:42:49 -0230 Subject: [PATCH 12/29] fix(test): add stash name --- pkg/integration/tests/stash/stash.go | 5 ++++- .../stash/expected/repo/.git_keep/COMMIT_EDITMSG | 1 + .../stash/expected/repo/.git_keep/FETCH_HEAD | 0 .../stash/stash/expected/repo/.git_keep/HEAD | 1 + .../stash/stash/expected/repo/.git_keep/ORIG_HEAD | 1 + .../stash/stash/expected/repo/.git_keep/config | 12 ++++++++++++ .../stash/expected/repo/.git_keep/description | 1 + .../stash/stash/expected/repo/.git_keep/index | Bin 0 -> 65 bytes .../stash/expected/repo/.git_keep/info/exclude | 6 ++++++ .../stash/stash/expected/repo/.git_keep/logs/HEAD | 2 ++ .../repo/.git_keep/logs/refs/heads/master | 1 + .../stash/expected/repo/.git_keep/logs/refs/stash | 1 + .../4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | Bin 0 -> 15 bytes .../62/27ee90e6cf6047b510f13dc6cc976e2dd372dd | Bin 0 -> 122 bytes .../6b/584e8ece562ebffc15d38808cd6b98fc3d97ea | Bin 0 -> 22 bytes .../9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 | 1 + .../d9/1d06157bdc633d25f970b9cc54d0eb74fb850f | Bin 0 -> 49 bytes .../f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c | Bin 0 -> 168 bytes .../expected/repo/.git_keep/refs/heads/master | 1 + .../stash/expected/repo/.git_keep/refs/stash | 1 + 20 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/COMMIT_EDITMSG create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/FETCH_HEAD create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/HEAD create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/config create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/description create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/index create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/info/exclude create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/logs/HEAD create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/62/27ee90e6cf6047b510f13dc6cc976e2dd372dd create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/d9/1d06157bdc633d25f970b9cc54d0eb74fb850f create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index 55095e42d..db9e13b78 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -19,7 +19,10 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ assert.StashCount(0) input.PressKeys(keys.Files.ViewStashOptions) - input.Confirm() + assert.InMenu() + + input.PressKeys("a") + input.Type("stash name") input.Confirm() assert.StashCount(1) diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/stash/stash/expected/repo/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..802607664 --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +initial commit diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/stash/stash/expected/repo/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/HEAD b/test/integration_new/stash/stash/expected/repo/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD b/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..bf1549f7e --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +6227ee90e6cf6047b510f13dc6cc976e2dd372dd diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/config b/test/integration_new/stash/stash/expected/repo/.git_keep/config new file mode 100644 index 000000000..8a748ce32 --- /dev/null +++ b/test/integration_new/stash/stash/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/expected/repo/.git_keep/description b/test/integration_new/stash/stash/expected/repo/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration_new/stash/stash/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/expected/repo/.git_keep/index b/test/integration_new/stash/stash/expected/repo/.git_keep/index new file mode 100644 index 0000000000000000000000000000000000000000..65d675154f23ffb2d0196e017d44a5e7017550f5 GIT binary patch literal 65 zcmZ?q402{*U|<4bhL9jvS0E+HV4z^Y<=qr}%;|LA&IJiiy? 1665104980 -0230 commit (initial): initial commit +6227ee90e6cf6047b510f13dc6cc976e2dd372dd 6227ee90e6cf6047b510f13dc6cc976e2dd372dd CI 1665104985 -0230 reset: moving to HEAD diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..b4cda7b51 --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6227ee90e6cf6047b510f13dc6cc976e2dd372dd CI 1665104980 -0230 commit (initial): initial commit diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash new file mode 100644 index 000000000..080ed95ff --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 9ca683cf1ae1a37fb25ec24646acc0dc1db376e7 CI 1665104985 -0230 On master: stash name diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000000000000000000000000000000000000..adf64119a33d7621aeeaa505d30adb58afaa5559 GIT binary patch literal 15 Wcmb^n>|+@|><-_+ilTuX0vu*}{f c#eguN8_^u}n5g`zoBFC+(*|c}etoMixhRc2*Z=?k literal 0 HcmV?d00001 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea new file mode 100644 index 0000000000000000000000000000000000000000..ec9764eae7ae13711d9505390685b84b0bafd229 GIT binary patch literal 22 dcmb9VlXr?Ff%bxNXyJgWyp^3>pK^wxBrjm)vLZHH-w%QWBk?dxOVQ{3tmBvGdZHySvi(kOb{r5gV^7iCTShHZuF WpPf4Yte~u=6~DmuP<#Lq^hKmQJx_iB literal 0 HcmV?d00001 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master new file mode 100644 index 000000000..bf1549f7e --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master @@ -0,0 +1 @@ +6227ee90e6cf6047b510f13dc6cc976e2dd372dd diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash new file mode 100644 index 000000000..c03c37c76 --- /dev/null +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash @@ -0,0 +1 @@ +9ca683cf1ae1a37fb25ec24646acc0dc1db376e7 From a30d924afe8e996dd0517bc70855803858efc362 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Thu, 6 Oct 2022 22:53:13 -0230 Subject: [PATCH 13/29] test: add test for stash including untracked files --- pkg/integration/tests/stash/stash.go | 2 ++ .../stash/stash_including_untracked_files.go | 33 ++++++++++++++++++ pkg/integration/tests/tests.go | 1 + .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 + .../expected/repo/.git_keep/FETCH_HEAD | 0 .../expected/repo/.git_keep/HEAD | 1 + .../expected/repo/.git_keep/ORIG_HEAD | 1 + .../expected/repo/.git_keep/config | 12 +++++++ .../expected/repo/.git_keep/description | 1 + .../expected/repo/.git_keep/index | Bin 0 -> 65 bytes .../expected/repo/.git_keep/info/exclude | 6 ++++ .../expected/repo/.git_keep/logs/HEAD | 2 ++ .../repo/.git_keep/logs/refs/heads/master | 1 + .../expected/repo/.git_keep/logs/refs/stash | 1 + .../18/77c1658e50742642146b3bbb24c6b8635c7b64 | Bin 0 -> 51 bytes .../4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | Bin 0 -> 15 bytes .../6b/584e8ece562ebffc15d38808cd6b98fc3d97ea | Bin 0 -> 22 bytes .../9d/49589525f6c37d177a53a57d82603a22de6076 | Bin 0 -> 170 bytes .../b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 | 2 ++ .../d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f | Bin 0 -> 122 bytes .../dd/e611c48bd5d6df4157b99f524929851b07eca9 | Bin 0 -> 51 bytes .../f8/528a899ebb020e575e007426baa4535207a214 | 2 ++ .../expected/repo/.git_keep/refs/heads/master | 1 + .../expected/repo/.git_keep/refs/stash | 1 + 24 files changed, 68 insertions(+) create mode 100644 pkg/integration/tests/stash/stash_including_untracked_files.go create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/COMMIT_EDITMSG create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/FETCH_HEAD create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/HEAD create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/ORIG_HEAD create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/config create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/description create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/index create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/info/exclude create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/HEAD create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/heads/master create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/logs/refs/stash create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/18/77c1658e50742642146b3bbb24c6b8635c7b64 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/6b/584e8ece562ebffc15d38808cd6b98fc3d97ea create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/9d/49589525f6c37d177a53a57d82603a22de6076 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/dd/e611c48bd5d6df4157b99f524929851b07eca9 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/heads/master create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/refs/stash 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 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 new file mode 100644 index 0000000000000000000000000000000000000000..65d675154f23ffb2d0196e017d44a5e7017550f5 GIT binary patch literal 65 zcmZ?q402{*U|<4bhL9jvS0E+HV4z^Y<=qr}%;|LA&IJiiy? 1665105632 -0230 commit (initial): initial commit +d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI 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 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 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 new file mode 100644 index 0000000000000000000000000000000000000000..c5ff32d892058a343ef1582aee42127eb222f8ca GIT binary patch literal 51 zcmV-30L=e*0V^p=O;s>9VK6i>Ff%bxNXyJgjW=S*j_~U{7pAxWkLcwNj%%m`r=`i7gC0>s|2a2p5q-kC YKTncL_5c6? literal 0 HcmV?d00001 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* +#;Ƿ7wx׶1nT-"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 new file mode 100644 index 0000000000000000000000000000000000000000..d412fdb6927f1dfd30d03f4a72a0f11807a62c58 GIT binary patch literal 122 zcmV-=0EPc}0ga7Y3c@fD0R7G>_5#Z0u}cCXLce;9Y`VojW28jz_!hi?zrzeudTVun zC4U;bDg=p+mcqdmVU?7TQ7On87fvq5Ra8U5VDfuB`VP|!*J-}%C%4z8m(tq}EHhao c_72YIJeq?Zlc9g=ratSad4pePzI(tguaL(&(f|Me literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..1721a0ff4e35747e550d2943331beb3c1e434a45 GIT binary patch literal 51 zcmV-30L=e*0V^p=O;s>9VK6i>Ff%bxNXyJgjW=Y-j_~U{7pAxWkLcwNj Date: Thu, 6 Oct 2022 23:03:34 -0230 Subject: [PATCH 14/29] clean: delete old integration artifacts --- .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../expected/repo/.git_keep/FETCH_HEAD | 0 .../expected/repo/.git_keep/HEAD | 1 - .../expected/repo/.git_keep/ORIG_HEAD | 1 - .../expected/repo/.git_keep/config | 10 ---------- .../expected/repo/.git_keep/description | 1 - .../expected/repo/.git_keep/index | Bin 65 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 6 ------ .../expected/repo/.git_keep/logs/HEAD | 2 -- .../repo/.git_keep/logs/refs/heads/master | 1 - .../expected/repo/.git_keep/logs/refs/stash | 1 - .../09/767bd3484e22b41138116992cc1cb5bc45fb7f | Bin 50 -> 0 bytes .../3b/f44f88f6673290a762ccc832cf31fe74ef91f1 | Bin 122 -> 0 bytes .../4b/7be4c80e71164df70d6af8dedd4eee60fc042a | Bin 147 -> 0 bytes .../4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | Bin 15 -> 0 bytes .../98/9eb86a55fc4942f907cceddb0c83357cf29c30 | Bin 221 -> 0 bytes .../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | Bin 15 -> 0 bytes .../e8/9483c44e35b3cc03c03ae56747f60ca7832f9c | 3 --- .../expected/repo/.git_keep/refs/heads/master | 1 - .../expected/repo/.git_keep/refs/stash | 1 - .../stashIncludeUntrackedChanges/recording.json | 1 - .../stashIncludeUntrackedChanges/setup.sh | 14 -------------- .../stashIncludeUntrackedChanges/test.json | 1 - 23 files changed, 45 deletions(-) delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/7be4c80e71164df70d6af8dedd4eee60fc042a delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/98/9eb86a55fc4942f907cceddb0c83357cf29c30 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e8/9483c44e35b3cc03c03ae56747f60ca7832f9c delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/stash delete mode 100644 test/integration/stashIncludeUntrackedChanges/recording.json delete mode 100644 test/integration/stashIncludeUntrackedChanges/setup.sh delete mode 100644 test/integration/stashIncludeUntrackedChanges/test.json diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 5852f4463..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD deleted file mode 100644 index 890bb1577..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/ORIG_HEAD +++ /dev/null @@ -1 +0,0 @@ -3bf44f88f6673290a762ccc832cf31fe74ef91f1 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/index deleted file mode 100644 index 65d675154f23ffb2d0196e017d44a5e7017550f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65 zcmZ?q402{*U|<4bhL9jvS0E+HV4z^Y<=qr}%;|LA&IJiiy? 1655848119 -0230 commit (initial): Initial commit -3bf44f88f6673290a762ccc832cf31fe74ef91f1 3bf44f88f6673290a762ccc832cf31fe74ef91f1 CI 1655848130 -0230 reset: moving to HEAD diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 5f82957c2..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 3bf44f88f6673290a762ccc832cf31fe74ef91f1 CI 1655848119 -0230 commit (initial): Initial commit diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash deleted file mode 100644 index 686bd5ddd..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/logs/refs/stash +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 989eb86a55fc4942f907cceddb0c83357cf29c30 CI 1655848130 -0230 On master: stash untracked changes diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/09/767bd3484e22b41138116992cc1cb5bc45fb7f deleted file mode 100644 index d09fb5ad6408a5f924793e8b825d8666b6f550a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmbRj diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/3b/f44f88f6673290a762ccc832cf31fe74ef91f1 deleted file mode 100644 index e3d77a36c2934f40a247459cb93aaed03d2f596a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122 zcmV-=0EPc}0ga783c@fD06pgw`vE0MH_HY@gr4$@B;8`5F;Z6W`4;?u*I|aKqxYuZ z!gSJI1hB9VOC|KRkd&A$SqWHHUMPCzwTNJ}X!2VhV~07xbxwEr^Qb)gmqYxO` cxd>xqya&p{2$cldgIUphF}UFfC0yzD>M<+n@K|4>jl1 z0IfZ>l^NvFcfFrASz@I;A!>`*4TA~+gEu~qiN24*?d@4t7$>-m(}O=QzZbrQn(u&} zF_tW931_La6vuj;H2xD8dugi+FP-3ff1aXkjX;CAYvYExvP{I~^TL BLP7ul diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 deleted file mode 100644 index adf64119a33d7621aeeaa505d30adb58afaa5559..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15 WcmbqTIx=2COi diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 deleted file mode 100644 index 711223894375fe1186ac5bfffdc48fb1fa1e65cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15 Wcmb2V@SDfHL"KAbv{t.G6+ؘ[^1,lM${ -\6zuCPI.i)w04V=9W< %W<1LE \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/heads/master b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 890bb1577..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -3bf44f88f6673290a762ccc832cf31fe74ef91f1 diff --git a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/stash b/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/stash deleted file mode 100644 index 18155ded2..000000000 --- a/test/integration/stashIncludeUntrackedChanges/expected/repo/.git_keep/refs/stash +++ /dev/null @@ -1 +0,0 @@ -989eb86a55fc4942f907cceddb0c83357cf29c30 diff --git a/test/integration/stashIncludeUntrackedChanges/recording.json b/test/integration/stashIncludeUntrackedChanges/recording.json deleted file mode 100644 index 1e73e7b2e..000000000 --- a/test/integration/stashIncludeUntrackedChanges/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":2184,"Mod":0,"Key":256,"Ch":83},{"Timestamp":3503,"Mod":0,"Key":256,"Ch":85},{"Timestamp":4941,"Mod":0,"Key":256,"Ch":115},{"Timestamp":5044,"Mod":0,"Key":256,"Ch":116},{"Timestamp":5168,"Mod":0,"Key":256,"Ch":97},{"Timestamp":5269,"Mod":0,"Key":256,"Ch":115},{"Timestamp":5424,"Mod":0,"Key":256,"Ch":104},{"Timestamp":6607,"Mod":0,"Key":256,"Ch":32},{"Timestamp":6867,"Mod":0,"Key":256,"Ch":117},{"Timestamp":6957,"Mod":0,"Key":256,"Ch":110},{"Timestamp":7124,"Mod":0,"Key":256,"Ch":116},{"Timestamp":7272,"Mod":0,"Key":256,"Ch":114},{"Timestamp":7326,"Mod":0,"Key":256,"Ch":97},{"Timestamp":7475,"Mod":0,"Key":256,"Ch":99},{"Timestamp":7552,"Mod":0,"Key":256,"Ch":107},{"Timestamp":7642,"Mod":0,"Key":256,"Ch":101},{"Timestamp":7699,"Mod":0,"Key":256,"Ch":100},{"Timestamp":7845,"Mod":0,"Key":256,"Ch":32},{"Timestamp":8205,"Mod":0,"Key":256,"Ch":99},{"Timestamp":8292,"Mod":0,"Key":256,"Ch":104},{"Timestamp":8361,"Mod":0,"Key":256,"Ch":97},{"Timestamp":8463,"Mod":0,"Key":256,"Ch":110},{"Timestamp":8541,"Mod":0,"Key":256,"Ch":103},{"Timestamp":8611,"Mod":0,"Key":256,"Ch":101},{"Timestamp":8676,"Mod":0,"Key":256,"Ch":115},{"Timestamp":10433,"Mod":0,"Key":13,"Ch":13},{"Timestamp":16577,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":294,"Height":79}]} \ No newline at end of file diff --git a/test/integration/stashIncludeUntrackedChanges/setup.sh b/test/integration/stashIncludeUntrackedChanges/setup.sh deleted file mode 100644 index 4912cbb3e..000000000 --- a/test/integration/stashIncludeUntrackedChanges/setup.sh +++ /dev/null @@ -1,14 +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" - -touch file0 diff --git a/test/integration/stashIncludeUntrackedChanges/test.json b/test/integration/stashIncludeUntrackedChanges/test.json deleted file mode 100644 index b67e32c62..000000000 --- a/test/integration/stashIncludeUntrackedChanges/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "Stashing all files including untracked files", "speed": 20 } From 66a253916ea35a1d73b6df4f5daea1164df289c4 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sat, 12 Nov 2022 18:03:43 -0330 Subject: [PATCH 15/29] test: add more assertions --- pkg/integration/tests/stash/stash.go | 6 ++++-- .../stash/stash_including_untracked_files.go | 6 ++++-- .../stash/stash/expected/repo/.git_keep/ORIG_HEAD | 2 +- .../stash/stash/expected/repo/.git_keep/logs/HEAD | 4 ++-- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../stash/expected/repo/.git_keep/logs/refs/stash | 2 +- .../62/27ee90e6cf6047b510f13dc6cc976e2dd372dd | Bin 122 -> 0 bytes .../9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 | 1 - .../b4/ba8c398d35c204cc9ae06e120c6f0801fd3f32 | 1 + .../c8/6eeda485a49ca608cb2617bb027be66cd92bc3 | Bin 0 -> 191 bytes .../e6/ed7d5c2198fa4791de9c66e8000da607eaf9a3 | Bin 0 -> 123 bytes .../f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c | Bin 168 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 2 +- .../stash/expected/repo/.git_keep/refs/stash | 2 +- .../expected/repo/.git_keep/ORIG_HEAD | 2 +- .../expected/repo/.git_keep/logs/HEAD | 4 ++-- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../expected/repo/.git_keep/logs/refs/stash | 2 +- .../03/892119fb6b807d1c13c23f6baacdc4a170e694 | 1 + .../0f/e7bff1bede9ebb8de52517a4b75ad0f80be423 | Bin 0 -> 147 bytes .../36/4ac39500dfec09956626a513736d7602b4d64a | Bin 0 -> 123 bytes .../8d/147cc9d3f9cf40d1723b9099b98ffdb3727f8b | Bin 0 -> 167 bytes .../9d/49589525f6c37d177a53a57d82603a22de6076 | Bin 170 -> 0 bytes .../b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 | 2 -- .../d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f | Bin 122 -> 0 bytes .../f8/528a899ebb020e575e007426baa4535207a214 | 2 -- .../expected/repo/.git_keep/refs/heads/master | 2 +- .../expected/repo/.git_keep/refs/stash | 2 +- 28 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/62/27ee90e6cf6047b510f13dc6cc976e2dd372dd delete mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/b4/ba8c398d35c204cc9ae06e120c6f0801fd3f32 create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/c8/6eeda485a49ca608cb2617bb027be66cd92bc3 create mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/e6/ed7d5c2198fa4791de9c66e8000da607eaf9a3 delete mode 100644 test/integration_new/stash/stash/expected/repo/.git_keep/objects/f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/03/892119fb6b807d1c13c23f6baacdc4a170e694 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/0f/e7bff1bede9ebb8de52517a4b75ad0f80be423 create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/36/4ac39500dfec09956626a513736d7602b4d64a create mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/8d/147cc9d3f9cf40d1723b9099b98ffdb3727f8b delete mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/9d/49589525f6c37d177a53a57d82603a22de6076 delete mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 delete mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/d2/5b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f delete mode 100644 test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index af247550b..00d666168 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -23,9 +23,11 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ assert.InMenu() input.PressKeys("a") - input.Type("stash name") - input.Confirm() + assert.InPrompt() + assert.MatchCurrentViewTitle(Equals("Stash changes")) + input.Type("my stashed file") + 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 index 4ed7957ac..2f37f943c 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -24,9 +24,11 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ assert.InMenu() input.PressKeys("U") - input.Type("stash name") - input.Confirm() + assert.InPrompt() + assert.MatchCurrentViewTitle(Equals("Stash changes")) + input.Type("my stashed file") + input.Confirm() assert.StashCount(1) assert.WorkingTreeFileCount(0) }, diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD b/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD index bf1549f7e..9130d91a2 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/ORIG_HEAD @@ -1 +1 @@ -6227ee90e6cf6047b510f13dc6cc976e2dd372dd +e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/HEAD b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/HEAD index 276b4169c..e89e8b09a 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/HEAD +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/HEAD @@ -1,2 +1,2 @@ -0000000000000000000000000000000000000000 6227ee90e6cf6047b510f13dc6cc976e2dd372dd CI 1665104980 -0230 commit (initial): initial commit -6227ee90e6cf6047b510f13dc6cc976e2dd372dd 6227ee90e6cf6047b510f13dc6cc976e2dd372dd CI 1665104985 -0230 reset: moving to HEAD +0000000000000000000000000000000000000000 e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 CI 1668288675 -0330 commit (initial): initial commit +e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 CI 1668288676 -0330 reset: moving to HEAD diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master index b4cda7b51..79820d14f 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 6227ee90e6cf6047b510f13dc6cc976e2dd372dd CI 1665104980 -0230 commit (initial): initial commit +0000000000000000000000000000000000000000 e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 CI 1668288675 -0330 commit (initial): initial commit diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash index 080ed95ff..6933fca6b 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/logs/refs/stash @@ -1 +1 @@ -0000000000000000000000000000000000000000 9ca683cf1ae1a37fb25ec24646acc0dc1db376e7 CI 1665104985 -0230 On master: stash name +0000000000000000000000000000000000000000 c86eeda485a49ca608cb2617bb027be66cd92bc3 CI 1668288676 -0330 On master: my stashed file diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/62/27ee90e6cf6047b510f13dc6cc976e2dd372dd b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/62/27ee90e6cf6047b510f13dc6cc976e2dd372dd deleted file mode 100644 index 498500cc1d14256a3188020f659d74678d4ea527..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122 zcmV-=0EPc}0ga783d0}}0DJZo`+=0ztcyY^g`DyXH5)3#TEZ6k{08!YUWXZ`^wz3^ z_2Wf%5uhBLUkZ~enI*@BjN&P;Vd3aPShEO4B$Gb+>^n>|+@|><-_+ilTuX0vu*}{f c#eguN8_^u}n5g`zoBFC+(*|c}etoMixhRc2*Z=?k diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 deleted file mode 100644 index 229d54ce7..000000000 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/9c/a683cf1ae1a37fb25ec24646acc0dc1db376e7 +++ /dev/null @@ -1 +0,0 @@ -xj1DSW$J2!\7HDwN|ոO3fBM"J&ַ$*j -: 1PfhER`RfѨ³ZbhjH\eAcM%ʒpzֿ![X3"9~ l?=^ZSUA HdrN/)ra,sX̃w];()ÁkDQ0(߷n|ߦ=@mc=~x7u}B߃^y?yNFY \ No newline at end of file diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/c8/6eeda485a49ca608cb2617bb027be66cd92bc3 b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/c8/6eeda485a49ca608cb2617bb027be66cd92bc3 new file mode 100644 index 0000000000000000000000000000000000000000..330924b9fac1677da05eecc3fe64cd61b396ea8a GIT binary patch literal 191 zcmV;w06_nE0gcZ+P6IIzhGFVG#asY1{u|o}A*58PIKy~mtVD{l(XNr;_H08>`{{X$ zPu4N66FlM5+{{3$QzVyiQ=t&lr(QF*Dw3k2wH$jZ3H$Qk&F&M7OtU8Ou9nU*AGuW_ zvVw@pgxR=P4u8JI#zjIc8jc8~NM%DZ=TWF*LDx0(;1~Xymvw{F8QxCk5BuivxY>)W t;~gAP@ug5Ec*YQLIo9LEw14vD^A3ae!@t7#fqn9RF@=7;*)In=PlT-fV=4du literal 0 HcmV?d00001 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/e6/ed7d5c2198fa4791de9c66e8000da607eaf9a3 b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/e6/ed7d5c2198fa4791de9c66e8000da607eaf9a3 new file mode 100644 index 0000000000000000000000000000000000000000..e53b1e0685465dbedd3532d1a96f05ac7c570599 GIT binary patch literal 123 zcmV->0EGW|0ga7Y3c@fD0R7G>_5w(zhrbK6Eel5QL}fnh6SSuVI^i4wNvRMuXeyR!(*C9{-(Nbe9NsqVL%LB d#k+^AwpOc7`$YIpU6pr{k~a8t>I8(zFWt0#J0t)A literal 0 HcmV?d00001 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/objects/f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c b/test/integration_new/stash/stash/expected/repo/.git_keep/objects/f3/30ace8ec625fc87fe24138f3c4d65e7e8d9b8c deleted file mode 100644 index c63423382db7755e5c4753cc40cbd055cfdf4256..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 168 zcmV;Z09XHb0gaAL3c@fDg)vLZHH-w%QWBk?dxOVQ{3tmBvGdZHySvi(kOb{r5gV^7iCTShHZuF WpPf4Yte~u=6~DmuP<#Lq^hKmQJx_iB diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master index bf1549f7e..9130d91a2 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/heads/master @@ -1 +1 @@ -6227ee90e6cf6047b510f13dc6cc976e2dd372dd +e6ed7d5c2198fa4791de9c66e8000da607eaf9a3 diff --git a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash index c03c37c76..a976f263d 100644 --- a/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash +++ b/test/integration_new/stash/stash/expected/repo/.git_keep/refs/stash @@ -1 +1 @@ -9ca683cf1ae1a37fb25ec24646acc0dc1db376e7 +c86eeda485a49ca608cb2617bb027be66cd92bc3 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 index 4ee40e25d..8b6d164d8 100644 --- 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 @@ -1 +1 @@ -d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f +364ac39500dfec09956626a513736d7602b4d64a 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 index e8dcfb6d1..1350d45f0 100644 --- 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 @@ -1,2 +1,2 @@ -0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI 1665105632 -0230 commit (initial): initial commit -d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI 1665105633 -0230 reset: moving to HEAD +0000000000000000000000000000000000000000 364ac39500dfec09956626a513736d7602b4d64a CI 1668288767 -0330 commit (initial): initial commit +364ac39500dfec09956626a513736d7602b4d64a 364ac39500dfec09956626a513736d7602b4d64a CI 1668288768 -0330 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 index df042a3dd..9653f3a4b 100644 --- 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 @@ -1 +1 @@ -0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI 1665105632 -0230 commit (initial): initial commit +0000000000000000000000000000000000000000 364ac39500dfec09956626a513736d7602b4d64a CI 1668288767 -0330 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 index 335d6aab8..9fa56fb7b 100644 --- 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 @@ -1 +1 @@ -0000000000000000000000000000000000000000 b8eb39e727d4ac91542d57faa0bea0458c2d30e3 CI 1665105633 -0230 On master: stash name +0000000000000000000000000000000000000000 03892119fb6b807d1c13c23f6baacdc4a170e694 CI 1668288768 -0330 On master: my stashed file diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/03/892119fb6b807d1c13c23f6baacdc4a170e694 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/03/892119fb6b807d1c13c23f6baacdc4a170e694 new file mode 100644 index 000000000..c933b47b3 --- /dev/null +++ b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/03/892119fb6b807d1c13c23f6baacdc4a170e694 @@ -0,0 +1 @@ +x=jA {@_2!\F# <^@rL>__Ǹ.U'%KK>W&F˽=6ÒZĴQ.%}H-84OS$uK 4C&45TC~z0lYEIQ4kK\s0ҾpǓ{?>U:>/b-^!FX:OO|h7~ݶr?]. \ No newline at end of file diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/0f/e7bff1bede9ebb8de52517a4b75ad0f80be423 b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/0f/e7bff1bede9ebb8de52517a4b75ad0f80be423 new file mode 100644 index 0000000000000000000000000000000000000000..aacb0bb13cbf27bd76012d487ee42ffd64469722 GIT binary patch literal 147 zcmV;E0Brww0ga7a3c@fDgniB__5w=t)6H5$gg*5c$+}{&X{1fT;~Ve-z74}S-*Cw} zRnSC-x{9>mJ!|Yq`p!Fp&S;0x#u$xbjD)slAJM6>*JoK_oZvD}H~ED8p5??PUqK_1 zA@WFY?5yonYuibcKXJ7$bq)NIJ3P`X80EGW|0ga783d0}}0DJZo`+*jt>qeoJKu&pvYc^DfwFC=!euaLZ*I|Z9wUpdo zaQ4y;5kU6Ft%=YiCgBh@X>rJ#Unv;xHx|L5QN>St)&u4R?(;Iq8OwW@TdL&&1Cj6Q dNF!XewOV!BCr$p;Ret4`;|{-0eF24uFX67lI{*Lx literal 0 HcmV?d00001 diff --git a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/8d/147cc9d3f9cf40d1723b9099b98ffdb3727f8b b/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/8d/147cc9d3f9cf40d1723b9099b98ffdb3727f8b new file mode 100644 index 0000000000000000000000000000000000000000..84ee6636f96bcbcd23694592cedfb3f9e7b3740f GIT binary patch literal 167 zcmV;Y09gNc0gaAL3c@fDMqTF=a{(p4lSD*>u6m3#GsQsDmKveQw;=A_e!TDT@=|MQ zpf#S_#tcM^N@W`ca)dNm<@^xi=(LSG2B!w;Ij1PrwDH`)piS9CCnb%XWsD9{V{*!P zgXB@_!P3Eq^lr~(gRX~L*FShqb)EQAM5lVYQj-7x literal 0 HcmV?d00001 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 deleted file mode 100644 index 99fe3e9e508ead758850bf649230405ae62bedb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 170 zcmV;b09F5Z0gaA9YQr!PMZ4B1<^nC6u_Q|&ghEz1#z-@wg2*%%m`r=`i7gC0>s|2a2p5q-kC YKTncL_5c6? 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 deleted file mode 100644 index eb6b19046..000000000 --- a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/b8/eb39e727d4ac91542d57faa0bea0458c2d30e3 +++ /dev/null @@ -1,2 +0,0 @@ -xMJ1`}\@#"¬f* -#;Ƿ7wx׶1nT-"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 deleted file mode 100644 index d412fdb6927f1dfd30d03f4a72a0f11807a62c58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122 zcmV-=0EPc}0ga7Y3c@fD0R7G>_5#Z0u}cCXLce;9Y`VojW28jz_!hi?zrzeudTVun zC4U;bDg=p+mcqdmVU?7TQ7On87fvq5Ra8U5VDfuB`VP|!*J-}%C%4z8m(tq}EHhao c_72YIJeq?Zlc9g=ratSad4pePzI(tguaL(&(f|Me 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 deleted file mode 100644 index 8cc3c848b..000000000 --- a/test/integration_new/stash/stash_including_untracked_files/expected/repo/.git_keep/objects/f8/528a899ebb020e575e007426baa4535207a214 +++ /dev/null @@ -1,2 +0,0 @@ -x] -0})J~7A}16o 6 |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 index 4ee40e25d..8b6d164d8 100644 --- 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 @@ -1 +1 @@ -d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f +364ac39500dfec09956626a513736d7602b4d64a 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 index 3e0f2a550..3512c8618 100644 --- 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 @@ -1 +1 @@ -b8eb39e727d4ac91542d57faa0bea0458c2d30e3 +03892119fb6b807d1c13c23f6baacdc4a170e694 From af57dbd225c4dae71cd59e0957a8206e4ded5fe7 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 9 Nov 2022 19:54:11 +1100 Subject: [PATCH 16/29] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44fc5c640..1b47f65b3 100644 --- a/README.md +++ b/README.md @@ -301,9 +301,9 @@ See the [docs](docs/Custom_Command_Keybindings.md) ## Contributing We love your input! Please check out the [contributing guide](CONTRIBUTING.md). -For contributor discussion about things not better discussed here in the repo, join the slack channel +For contributor discussion about things not better discussed here in the repo, join the discord channel -[![Slack](../assets/slack_rgb.png)](https://join.slack.com/t/lazygit/shared_invite/zt-5bo2clzo-hB8ZTVN5dWUCqj5QFiQVLA) +[![Discord](../assets/discord.png)](https://discord.gg/ehwFt2t4wt) Check out this [video](https://www.youtube.com/watch?v=kNavnhzZHtk) walking through the creation of a small feature in lazygit if you want an idea of where to get started. From 33410213f188bd6823c8cd84e3b39e9ef97e0e41 Mon Sep 17 00:00:00 2001 From: README-bot Date: Wed, 9 Nov 2022 08:54:28 +0000 Subject: [PATCH 17/29] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b47f65b3..e7071dc5f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A simple terminal UI for git commands, written in Go with the [gocui](https://gi

- +

## Elevator Pitch From c769e5828ca5fd847da15d7b4aeeb161f1fc169e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 9 Nov 2022 19:57:26 +1100 Subject: [PATCH 18/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e7071dc5f..77afcd72b 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ See the [docs](docs/Custom_Command_Keybindings.md) We love your input! Please check out the [contributing guide](CONTRIBUTING.md). For contributor discussion about things not better discussed here in the repo, join the discord channel -[![Discord](../assets/discord.png)](https://discord.gg/ehwFt2t4wt) + Check out this [video](https://www.youtube.com/watch?v=kNavnhzZHtk) walking through the creation of a small feature in lazygit if you want an idea of where to get started. From ea0968677048b3236e3797e947e4d458096750ed Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 9 Nov 2022 21:14:14 +1100 Subject: [PATCH 19/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77afcd72b..dba27162e 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ See the [docs](docs/Custom_Command_Keybindings.md) We love your input! Please check out the [contributing guide](CONTRIBUTING.md). For contributor discussion about things not better discussed here in the repo, join the discord channel - + Check out this [video](https://www.youtube.com/watch?v=kNavnhzZHtk) walking through the creation of a small feature in lazygit if you want an idea of where to get started. From 97ced9e14fe1754c5647c8c693e70fbf7c52807a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 11 Nov 2022 12:16:38 +1100 Subject: [PATCH 20/29] fix could-not-access error --- pkg/commands/git_commands/working_tree.go | 2 +- pkg/commands/models/file.go | 5 +++ pkg/gui/filetree/file_node.go | 4 +++ pkg/integration/components/shell.go | 9 +++++ .../tests/file/dir_with_untracked_file.go | 32 ++++++++++++++++++ pkg/integration/tests/tests.go | 2 ++ .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 + .../expected/repo/.git_keep/FETCH_HEAD | 0 .../expected/repo/.git_keep/HEAD | 1 + .../expected/repo/.git_keep/config | 12 +++++++ .../expected/repo/.git_keep/description | 1 + .../expected/repo/.git_keep/index | Bin 0 -> 165 bytes .../expected/repo/.git_keep/info/exclude | 7 ++++ .../expected/repo/.git_keep/logs/HEAD | 1 + .../repo/.git_keep/logs/refs/heads/master | 1 + .../19/102815663d23f8b75a47e7a01965dcdc96468c | Bin 0 -> 18 bytes .../76/3788c33660f53eecaecce8dae27c34e647ac57 | Bin 0 -> 121 bytes .../87/a5800c820f9b267ff243860bceb24b04af76a2 | Bin 0 -> 49 bytes .../a9/63b9597d0f4f0b9995472e5eff3622b136a4b5 | Bin 0 -> 45 bytes .../expected/repo/.git_keep/refs/heads/master | 1 + .../expected/repo/dir/file | 1 + .../expected/repo/dir/untracked | 1 + 22 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 pkg/integration/tests/file/dir_with_untracked_file.go create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/COMMIT_EDITMSG create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/FETCH_HEAD create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/HEAD create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/config create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/description create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/index create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/info/exclude create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/logs/HEAD create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/logs/refs/heads/master create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/19/102815663d23f8b75a47e7a01965dcdc96468c create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/76/3788c33660f53eecaecce8dae27c34e647ac57 create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/87/a5800c820f9b267ff243860bceb24b04af76a2 create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/a9/63b9597d0f4f0b9995472e5eff3622b136a4b5 create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/refs/heads/master create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/dir/file create mode 100644 test/integration_new/file/dir_with_untracked_file/expected/repo/dir/untracked diff --git a/pkg/commands/git_commands/working_tree.go b/pkg/commands/git_commands/working_tree.go index 8fd1fb177..9c02d4300 100644 --- a/pkg/commands/git_commands/working_tree.go +++ b/pkg/commands/git_commands/working_tree.go @@ -241,7 +241,7 @@ func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain if cached { cachedArg = " --cached" } - if !node.GetIsTracked() && !node.GetHasStagedChanges() && !cached { + if !node.GetIsTracked() && !node.GetHasStagedChanges() && !cached && node.GetIsFile() { trackedArg = "--no-index -- /dev/null" } if plain { diff --git a/pkg/commands/models/file.go b/pkg/commands/models/file.go index eeb540def..dbe015cf1 100644 --- a/pkg/commands/models/file.go +++ b/pkg/commands/models/file.go @@ -29,6 +29,7 @@ type IFile interface { GetIsTracked() bool GetPath() string GetPreviousPath() string + GetIsFile() bool } func (f *File) IsRename() bool { @@ -92,6 +93,10 @@ func (f *File) GetPreviousPath() string { return f.PreviousName } +func (f *File) GetIsFile() bool { + return true +} + type StatusFields struct { HasStagedChanges bool HasUnstagedChanges bool diff --git a/pkg/gui/filetree/file_node.go b/pkg/gui/filetree/file_node.go index 2ff707113..abfdbafe6 100644 --- a/pkg/gui/filetree/file_node.go +++ b/pkg/gui/filetree/file_node.go @@ -42,6 +42,10 @@ func (self *FileNode) GetIsTracked() bool { return self.SomeFile(func(file *models.File) bool { return file.Tracked }) } +func (self *FileNode) GetIsFile() bool { + return self.IsFile() +} + func (self *FileNode) GetPreviousPath() string { if self.File == nil { return "" diff --git a/pkg/integration/components/shell.go b/pkg/integration/components/shell.go index 1d8182edb..95b601783 100644 --- a/pkg/integration/components/shell.go +++ b/pkg/integration/components/shell.go @@ -45,6 +45,15 @@ func (s *Shell) CreateFile(path string, content string) *Shell { return s } +func (s *Shell) CreateDir(path string) *Shell { + fullPath := filepath.Join(s.dir, path) + if err := os.MkdirAll(fullPath, 0o755); err != nil { + panic(fmt.Sprintf("error creating directory: %s\n%s", fullPath, err)) + } + + return s +} + func (s *Shell) UpdateFile(path string, content string) *Shell { fullPath := filepath.Join(s.dir, path) err := os.WriteFile(fullPath, []byte(content), 0o644) diff --git a/pkg/integration/tests/file/dir_with_untracked_file.go b/pkg/integration/tests/file/dir_with_untracked_file.go new file mode 100644 index 000000000..c67745c65 --- /dev/null +++ b/pkg/integration/tests/file/dir_with_untracked_file.go @@ -0,0 +1,32 @@ +package file + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{ + // notably, we currently _don't_ actually see the untracked file in the diff. Not sure how to get around that. + Description: "When selecting a directory that contains an untracked file, we should not get an error", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) { + config.UserConfig.Gui.ShowFileTree = true + }, + SetupRepo: func(shell *Shell) { + shell.CreateDir("dir") + shell.CreateFile("dir/file", "foo") + shell.GitAddAll() + shell.Commit("first commit") + shell.CreateFile("dir/untracked", "bar") + shell.UpdateFile("dir/file", "baz") + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + assert.CommitCount(1) + + assert.MatchMainViewContent(NotContains("error: Could not access")) + // we show baz because it's a modified file but we don't show bar because it's untracked + // (though it would be cool if we could show that too) + assert.MatchMainViewContent(Contains("baz")) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index e26836b59..0765c8600 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -15,6 +15,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/cherry_pick" "github.com/jesseduffield/lazygit/pkg/integration/tests/commit" "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" + "github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" "github.com/jesseduffield/lazygit/pkg/utils" @@ -43,6 +44,7 @@ var tests = []*components.IntegrationTest{ stash.Stash, stash.StashIncludingUntrackedFiles, stash.Rename, + file.DirWithUntrackedFile, } func GetTests() []*components.IntegrationTest { diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..5ec586d22 --- /dev/null +++ b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +first commit diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/HEAD b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/config b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/config new file mode 100644 index 000000000..8a748ce32 --- /dev/null +++ b/test/integration_new/file/dir_with_untracked_file/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/file/dir_with_untracked_file/expected/repo/.git_keep/description b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/index b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/index new file mode 100644 index 0000000000000000000000000000000000000000..486f8bab9e2e329dca9349f939a0fd2479a4510e GIT binary patch literal 165 zcmZ?q402{*U|<4b#^l^3rxfl#_lMDp3=FJnpGw>q7#f!VrN08zhyXEzq=1HKnyvDW z?NRQ}7f7bwxiihJhk+v{vq(QJGbfdSAtcDv6{yUV!BD}FYi07z$Xb4X?wM2F_2T}U zDQz@cvK6QlC}+UczO;d-iGQ|Q{U_%(?sJ>GS=N^=GR 1668129994 +1100 commit (initial): first commit diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..5a93ac9cc --- /dev/null +++ b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 763788c33660f53eecaecce8dae27c34e647ac57 CI 1668129994 +1100 commit (initial): first commit diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/19/102815663d23f8b75a47e7a01965dcdc96468c b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/19/102815663d23f8b75a47e7a01965dcdc96468c new file mode 100644 index 0000000000000000000000000000000000000000..280a426b7656bd61cdd4f48a43f8088ea18291b6 GIT binary patch literal 18 Zcmbd;@;K>oCKtt=3He z2@l#uAaV4WiKn|Qq1epK6ecGmrTFMvMjuniWYSw7t;4*)WnOObNp*k9X>Iii7~>h; bC<7c3tu=#=iOQe4DO-Oj{3`PW+ubgI%49d` literal 0 HcmV?d00001 diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/87/a5800c820f9b267ff243860bceb24b04af76a2 b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/87/a5800c820f9b267ff243860bceb24b04af76a2 new file mode 100644 index 0000000000000000000000000000000000000000..115dcca4644a2968b0626173be1b391ff6e94da9 GIT binary patch literal 49 zcmV-10M7q-0V^p=O;s>9VlXr?Ff%bxNXyJgWsnrm5KXgH{;@sE{rLjP)H`>kx%B`5 H>1++gxn&gE literal 0 HcmV?d00001 diff --git a/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/a9/63b9597d0f4f0b9995472e5eff3622b136a4b5 b/test/integration_new/file/dir_with_untracked_file/expected/repo/.git_keep/objects/a9/63b9597d0f4f0b9995472e5eff3622b136a4b5 new file mode 100644 index 0000000000000000000000000000000000000000..ba6b1afcde1396992dcafef1d18d328bec541c01 GIT binary patch literal 45 zcmV+|0Mh?>0V^p=O;s>9U@$QN0)>>!B8K**4LnW!v(@T9Ik$12+vLr%zHAWy Date: Sat, 12 Nov 2022 10:18:02 +1100 Subject: [PATCH 21/29] fix broken CI (see https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html) try this WIP --- .github/workflows/ci.yml | 3 ++- pkg/integration/components/runner.go | 1 + test/integration/submoduleAdd/setup.sh | 5 +++++ test/integration/submoduleEnter/setup.sh | 2 +- test/integration/submoduleRemove/setup.sh | 2 +- test/integration/submoduleReset/setup.sh | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a781b290f..d09b8a53a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,8 +73,9 @@ jobs: restore-keys: | ${{runner.os}}-go- - name: Test code + # for file.allow thing see https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html run: | - PARALLEL_TOTAL=${{ matrix.parallelism }} PARALLEL_INDEX=${{ matrix.index }} go test pkg/integration/deprecated/*.go + git config --global protocol.file.allow always && PARALLEL_TOTAL=${{ matrix.parallelism }} PARALLEL_INDEX=${{ matrix.index }} go test pkg/integration/deprecated/*.go integration-tests: runs-on: ubuntu-latest name: "Integration Tests" diff --git a/pkg/integration/components/runner.go b/pkg/integration/components/runner.go index d25f3795c..11b34db11 100644 --- a/pkg/integration/components/runner.go +++ b/pkg/integration/components/runner.go @@ -144,6 +144,7 @@ func createFixture(test *IntegrationTest, paths Paths) error { shell.RunCommand(`git config user.email "CI@example.com"`) shell.RunCommand(`git config user.name "CI"`) shell.RunCommand(`git config commit.gpgSign false`) + shell.RunCommand(`git config protocol.file.allow always`) test.SetupRepo(shell) diff --git a/test/integration/submoduleAdd/setup.sh b/test/integration/submoduleAdd/setup.sh index 47c92bd27..35a139f79 100644 --- a/test/integration/submoduleAdd/setup.sh +++ b/test/integration/submoduleAdd/setup.sh @@ -11,6 +11,11 @@ git init git config user.email "CI@example.com" git config user.name "CI" +# see https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html +# NOTE: I don't think this actually works if it's only applied to the repo. +# On CI we set the global setting, but given it's a security concern I don't want +# people to do that for their locals. +git config protocol.file.allow always echo test1 > myfile1 git add . diff --git a/test/integration/submoduleEnter/setup.sh b/test/integration/submoduleEnter/setup.sh index 307593a71..a38c6045b 100644 --- a/test/integration/submoduleEnter/setup.sh +++ b/test/integration/submoduleEnter/setup.sh @@ -26,5 +26,5 @@ cd .. git clone --bare ./repo other_repo cd repo -git submodule add ../other_repo +git -c protocol.file.allow=always submodule add ../other_repo git commit -am "add submodule" diff --git a/test/integration/submoduleRemove/setup.sh b/test/integration/submoduleRemove/setup.sh index 2525abf31..cd5b3ce64 100644 --- a/test/integration/submoduleRemove/setup.sh +++ b/test/integration/submoduleRemove/setup.sh @@ -23,5 +23,5 @@ cd .. git clone --bare ./repo other_repo cd repo -git submodule add ../other_repo +git -c protocol.file.allow=always submodule add ../other_repo git commit -am "add submodule" diff --git a/test/integration/submoduleReset/setup.sh b/test/integration/submoduleReset/setup.sh index 2525abf31..cd5b3ce64 100644 --- a/test/integration/submoduleReset/setup.sh +++ b/test/integration/submoduleReset/setup.sh @@ -23,5 +23,5 @@ cd .. git clone --bare ./repo other_repo cd repo -git submodule add ../other_repo +git -c protocol.file.allow=always submodule add ../other_repo git commit -am "add submodule" From fd581ef70c22f881837eecdf02a16fcdfa039b61 Mon Sep 17 00:00:00 2001 From: README-bot Date: Fri, 11 Nov 2022 23:58:16 +0000 Subject: [PATCH 22/29] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dba27162e..a9fbba53d 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A simple terminal UI for git commands, written in Go with the [gocui](https://gi

- +

## Elevator Pitch From 91f83c6be7fd22ba202873841de4861be647625a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 11 Nov 2022 08:08:53 +1100 Subject: [PATCH 23/29] use better colour defaults --- docs/Config.md | 18 ------------------ pkg/config/user_config.go | 4 +--- pkg/gui/style/basic_styles.go | 1 + pkg/theme/theme.go | 15 ++------------- 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 82e36ec5b..aa5ceaaf9 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -29,7 +29,6 @@ gui: language: 'auto' # one of 'auto' | 'en' | 'zh' | 'pl' | 'nl' | 'ja' | 'ko' timeFormat: '02 Jan 06 15:04 MST' # https://pkg.go.dev/time#Time.Format theme: - lightTheme: false # For terminals with a light background activeBorderColor: - green - bold @@ -344,23 +343,6 @@ The available attributes are: - reverse # useful for high-contrast - underline -## Light terminal theme - -If you have issues with a light terminal theme where you can't read / see the text add these settings - -```yaml -gui: - theme: - lightTheme: true - activeBorderColor: - - black - - bold - inactiveBorderColor: - - black - selectedLineBgColor: - - default -``` - ## Highlighting the selected line If you don't like the default behaviour of highlighting the selected line with a blue background, you can use the `selectedLineBgColor` and `selectedRangeBgColor` keys to customise the behaviour. If you just want to embolden the selected line (this was the original default), you can do the following: diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index a90b100d5..c31c74fe0 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -55,7 +55,6 @@ type GuiConfig struct { } type ThemeConfig struct { - LightTheme bool `yaml:"lightTheme"` ActiveBorderColor []string `yaml:"activeBorderColor"` InactiveBorderColor []string `yaml:"inactiveBorderColor"` OptionsTextColor []string `yaml:"optionsTextColor"` @@ -358,9 +357,8 @@ func GetDefaultConfig() *UserConfig { Language: "auto", TimeFormat: time.RFC822, Theme: ThemeConfig{ - LightTheme: false, ActiveBorderColor: []string{"green", "bold"}, - InactiveBorderColor: []string{"white"}, + InactiveBorderColor: []string{"default"}, OptionsTextColor: []string{"blue"}, SelectedLineBgColor: []string{"blue"}, SelectedRangeBgColor: []string{"blue"}, diff --git a/pkg/gui/style/basic_styles.go b/pkg/gui/style/basic_styles.go index 99db37e20..e37e90001 100644 --- a/pkg/gui/style/basic_styles.go +++ b/pkg/gui/style/basic_styles.go @@ -27,6 +27,7 @@ var ( BgBlue = FromBasicBg(color.BgBlue) BgMagenta = FromBasicBg(color.BgMagenta) BgCyan = FromBasicBg(color.BgCyan) + BgDefault = FromBasicBg(color.BgDefault) // will not print any colour escape codes, including the reset escape code Nothing = New() diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index 39347702a..0970e08b7 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -24,9 +24,6 @@ var ( // DefaultTextColor is the default text color DefaultTextColor = style.FgWhite - // DefaultHiTextColor is the default highlighted text color - DefaultHiTextColor = style.FgLightWhite - // SelectedLineBgColor is the background color for the selected line SelectedLineBgColor = style.New() @@ -61,14 +58,6 @@ func UpdateTheme(themeConfig config.ThemeConfig) { OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor) OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false) - isLightTheme := themeConfig.LightTheme - if isLightTheme { - DefaultTextColor = style.FgBlack - DefaultHiTextColor = style.FgBlackLighter - GocuiDefaultTextColor = gocui.ColorBlack - } else { - DefaultTextColor = style.FgWhite - DefaultHiTextColor = style.FgLightWhite - GocuiDefaultTextColor = gocui.ColorWhite - } + DefaultTextColor = style.FgDefault + GocuiDefaultTextColor = gocui.ColorDefault } From f03e1e4e424e9b857c6dfbd23be16ba94ba5e9d8 Mon Sep 17 00:00:00 2001 From: Lukasz Piatkowski Date: Thu, 20 Oct 2022 10:33:47 +0200 Subject: [PATCH 24/29] Update go-git to handle negative refspecs --- go.mod | 2 +- go.sum | 4 +-- .../jesseduffield/go-git/v5/config/refspec.go | 27 ++++++++++++++++++- vendor/modules.txt | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index c485f8d1a..b05241506 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/imdario/mergo v0.3.11 github.com/integrii/flaggy v1.4.0 github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 - github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 + github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d github.com/jesseduffield/gocui v0.3.1-0.20221016041636-16c24668f71c github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 diff --git a/go.sum b/go.sum index 834defa9f..b55ed4aa6 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 h1:EQP2Tv8TIcC6Y4RI+1ZbJDOHfGJ570tPeYVCqo7/tws= github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68/go.mod h1:+LLj9/WUPAP8LqCchs7P+7X0R98HiFujVFANdNaxhGk= -github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 h1:GOQrmaE8i+KEdB8NzAegKYd4tPn/inM0I1uo0NXFerg= -github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o= +github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d h1:bO+OmbreIv91rCe8NmscRwhFSqkDJtzWCPV4Y+SQuXE= +github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o= github.com/jesseduffield/gocui v0.3.1-0.20221016041636-16c24668f71c h1:ttqCvM86hyp4V3DtRPxLo9imD1s+n6ry/zshPx0tt98= github.com/jesseduffield/gocui v0.3.1-0.20221016041636-16c24668f71c/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 h1:jmpr7KpX2+2GRiE91zTgfq49QvgiqB0nbmlwZ8UnOx0= diff --git a/vendor/github.com/jesseduffield/go-git/v5/config/refspec.go b/vendor/github.com/jesseduffield/go-git/v5/config/refspec.go index 3b0cb77e6..9af7abde5 100644 --- a/vendor/github.com/jesseduffield/go-git/v5/config/refspec.go +++ b/vendor/github.com/jesseduffield/go-git/v5/config/refspec.go @@ -11,11 +11,13 @@ const ( refSpecWildcard = "*" refSpecForce = "+" refSpecSeparator = ":" + refSpecNegative = "^" ) var ( ErrRefSpecMalformedSeparator = errors.New("malformed refspec, separators are wrong") ErrRefSpecMalformedWildcard = errors.New("malformed refspec, mismatched number of wildcards") + ErrRefSpecMalformedNegative = errors.New("malformed negative refspec, one ^ and no separators allowed") ) // RefSpec is a mapping from local branches to remote references. @@ -31,6 +33,24 @@ type RefSpec string // Validate validates the RefSpec func (s RefSpec) Validate() error { spec := string(s) + + if strings.Index(spec, refSpecNegative) == 0 { + // This is a negative refspec + if strings.Count(spec, refSpecNegative) != 1 { + return ErrRefSpecMalformedNegative + } + + if strings.Count(spec, refSpecSeparator) != 0 { + return ErrRefSpecMalformedNegative + } + + if strings.Count(spec, refSpecWildcard) > 1 { + return ErrRefSpecMalformedWildcard + } + + return nil + } + if strings.Count(spec, refSpecSeparator) != 1 { return ErrRefSpecMalformedSeparator } @@ -64,12 +84,17 @@ func (s RefSpec) IsExactSHA1() bool { return plumbing.IsHash(s.Src()) } +// IsNegative returns if the refspec is a negative one +func (s RefSpec) IsNegative() bool { + return s[0] == refSpecNegative[0] +} + // Src return the src side. func (s RefSpec) Src() string { spec := string(s) var start int - if s.IsForceUpdate() { + if s.IsForceUpdate() || s.IsNegative() { start = 1 } else { start = 0 diff --git a/vendor/modules.txt b/vendor/modules.txt index 1aa9becc1..94ee1ccc4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -128,7 +128,7 @@ github.com/jbenet/go-context/io github.com/jesseduffield/generics/maps github.com/jesseduffield/generics/set github.com/jesseduffield/generics/slices -# github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 +# github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d ## explicit; go 1.13 github.com/jesseduffield/go-git/v5 github.com/jesseduffield/go-git/v5/config From d7fb441a3ce85c04627c0c629166141e6cf5578a Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sat, 12 Nov 2022 18:09:10 -0330 Subject: [PATCH 25/29] refactor: sort list of integration tests --- pkg/integration/tests/tests.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 0765c8600..54b85c0a3 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -25,26 +25,27 @@ import ( // be sure to add it to this list. var tests = []*components.IntegrationTest{ - commit.Commit, - commit.NewBranch, - branch.Suggestions, + bisect.Basic, + bisect.FromOtherBranch, branch.Delete, branch.Rebase, branch.RebaseAndDrop, - interactive_rebase.One, - interactive_rebase.AmendMerge, - custom_commands.Basic, - custom_commands.MultiplePrompts, - custom_commands.MenuFromCommand, - bisect.Basic, - bisect.FromOtherBranch, + branch.Suggestions, cherry_pick.CherryPick, cherry_pick.CherryPickConflicts, + commit.Commit, + commit.NewBranch, + custom_commands.Basic, custom_commands.FormPrompts, - stash.Stash, - stash.StashIncludingUntrackedFiles, - stash.Rename, + custom_commands.MenuFromCommand, + custom_commands.MultiplePrompts, file.DirWithUntrackedFile, + interactive_rebase.AmendMerge, + interactive_rebase.One, + stash.Rename, + stash.Stash, + stash.StashIncludingUntrackedFiles, + stash.Stash, } func GetTests() []*components.IntegrationTest { From 7977c2deb524d91217f5f8e3d7730a4a4515b44d Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sat, 12 Nov 2022 18:10:34 -0330 Subject: [PATCH 26/29] fix: delete duplicate line --- pkg/integration/tests/tests.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 54b85c0a3..d4dfd03d9 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -45,7 +45,6 @@ var tests = []*components.IntegrationTest{ stash.Rename, stash.Stash, stash.StashIncludingUntrackedFiles, - stash.Stash, } func GetTests() []*components.IntegrationTest { From 9e91aa8b439e79b531debb46c1b6e88206146313 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sat, 12 Nov 2022 18:11:34 -0330 Subject: [PATCH 27/29] fix: delete duplicate import --- pkg/integration/tests/tests.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index d4dfd03d9..8d5f6adde 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -18,7 +18,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" - "github.com/jesseduffield/lazygit/pkg/utils" ) // Here is where we lists the actual tests that will run. When you create a new test, From 3c436b34576432322ec7eab29d5e9badc4094b26 Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sun, 13 Nov 2022 11:02:06 -0330 Subject: [PATCH 28/29] lint: delete unused argument from `handleStashSave` --- pkg/gui/controllers/files_controller.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 50ef448c9..08263ebd2 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -761,7 +761,7 @@ func (self *FilesController) createStashMenu() error { if !self.helpers.WorkingTree.IsWorkingTreeDirty() { return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) } - return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges) }, Key: 'a', }, @@ -772,14 +772,14 @@ func (self *FilesController) createStashMenu() error { return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) } // if there are no staged files it behaves the same as Stash.Save - return self.handleStashSave(self.git.Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex) }, Key: 'i', }, { Label: self.c.Tr.LcStashIncludeUntrackedChanges, OnPress: func() error { - return self.handleStashSave(self.git.Stash.StashIncludeUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.StashIncludeUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges) }, Key: 'U', }, @@ -790,7 +790,7 @@ func (self *FilesController) createStashMenu() error { if !self.helpers.WorkingTree.AnyStagedFiles() { return self.c.ErrorMsg(self.c.Tr.NoTrackedStagedFilesStash) } - return self.handleStashSave(self.git.Stash.SaveStagedChanges, self.c.Tr.Actions.StashStagedChanges, self.c.Tr.NoTrackedStagedFilesStash) + return self.handleStashSave(self.git.Stash.SaveStagedChanges, self.c.Tr.Actions.StashStagedChanges) }, Key: 's', }, @@ -801,10 +801,10 @@ func (self *FilesController) createStashMenu() error { return self.c.ErrorMsg(self.c.Tr.NoFilesToStash) } if self.helpers.WorkingTree.AnyStagedFiles() { - return self.handleStashSave(self.git.Stash.StashUnstagedChanges, self.c.Tr.Actions.StashUnstagedChanges, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.StashUnstagedChanges, self.c.Tr.Actions.StashUnstagedChanges) } // ordinary stash - return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashUnstagedChanges, self.c.Tr.NoFilesToStash) + return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashUnstagedChanges) }, Key: 'u', }, @@ -813,7 +813,7 @@ func (self *FilesController) createStashMenu() error { } func (self *FilesController) stash() error { - return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges, self.c.Tr.NoTrackedStagedFilesStash) + return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges) } func (self *FilesController) createResetToUpstreamMenu() error { @@ -841,7 +841,7 @@ func (self *FilesController) toggleTreeView() error { return self.c.PostRefreshUpdate(self.context()) } -func (self *FilesController) handleStashSave(stashFunc func(message string) error, action string, errorMsg string) error { +func (self *FilesController) handleStashSave(stashFunc func(message string) error, action string) error { return self.c.Prompt(types.PromptOpts{ Title: self.c.Tr.StashChanges, From 684d1e955e00847249c6543f33a65abe1a16746b Mon Sep 17 00:00:00 2001 From: Andrew Hynes Date: Sun, 13 Nov 2022 19:51:30 -0330 Subject: [PATCH 29/29] lint: try deleting blank line --- pkg/gui/controllers/files_controller.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 08263ebd2..2a4434264 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -842,7 +842,6 @@ func (self *FilesController) toggleTreeView() error { } func (self *FilesController) handleStashSave(stashFunc func(message string) error, action string) error { - return self.c.Prompt(types.PromptOpts{ Title: self.c.Tr.StashChanges, HandleConfirm: func(stashComment string) error {