From 57a1817debedc6a43d8200f662fe6b2a40127027 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 21 Dec 2022 22:51:39 +1100 Subject: [PATCH 1/9] don't kill long-running sandbox sessions --- pkg/gui/test_mode.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/gui/test_mode.go b/pkg/gui/test_mode.go index 97c291828..9c6b5f30d 100644 --- a/pkg/gui/test_mode.go +++ b/pkg/gui/test_mode.go @@ -8,6 +8,7 @@ import ( "time" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/integration/components" integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -17,6 +18,10 @@ type IntegrationTest interface { } func (gui *Gui) handleTestMode(test integrationTypes.IntegrationTest) { + if os.Getenv(components.SANDBOX_ENV_VAR) == "true" { + return + } + if test != nil { go func() { time.Sleep(time.Millisecond * 100) From 7c7f7bf9b9c8cc29cc785b7fec4128e1b54dbad1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 21 Dec 2022 22:52:23 +1100 Subject: [PATCH 2/9] migrate diffing integration tests --- pkg/integration/components/assert.go | 7 ++ pkg/integration/tests/diff/diff.go | 62 +++++++++++++++ .../tests/diff/diff_and_apply_patch.go | 74 ++++++++++++++++++ pkg/integration/tests/diff/diff_commits.go | 56 +++++++++++++ pkg/integration/tests/tests.go | 4 + .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../expected/repo/.git_keep/FETCH_HEAD | 0 .../diffing/expected/repo/.git_keep/HEAD | 1 - .../diffing/expected/repo/.git_keep/config | 10 --- .../expected/repo/.git_keep/description | 1 - .../diffing/expected/repo/.git_keep/index | Bin 353 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 7 -- .../diffing/expected/repo/.git_keep/logs/HEAD | 9 --- .../repo/.git_keep/logs/refs/heads/branch2 | 5 -- .../repo/.git_keep/logs/refs/heads/master | 4 - .../05/19814b4923f4639f1a47348b1539e3c5c54904 | Bin 147 -> 0 bytes .../0c/2aa38e0600e0d2df09c2f84664d8a14f899879 | Bin 36 -> 0 bytes .../14/4da8a531224129210249f43dded86056891506 | 2 - .../18/0cf8328022becee9aaa2577a8f84ea2b9f3827 | Bin 21 -> 0 bytes .../1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 | Bin 50 -> 0 bytes .../2d/00bd505971a8bc7318d98e003aee708a367c85 | Bin 24 -> 0 bytes .../38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da | Bin 21 -> 0 bytes .../3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a | Bin 31 -> 0 bytes .../3d/b2086f780b1cf632eec29111ef395913a8ab2b | Bin 127 -> 0 bytes .../57/51731b38a36f8eb54a4bb304522ca539e04522 | Bin 118 -> 0 bytes .../59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 | Bin 126 -> 0 bytes .../75/b31f81dd4387724638dbd3aff7380155c672cd | Bin 148 -> 0 bytes .../8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 | Bin 127 -> 0 bytes .../96/a6d041bbb131df0e74d179c3adcd2ace0e7f9c | Bin 146 -> 0 bytes .../9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c | Bin 101 -> 0 bytes .../a1/00b407f33fd2e97a3cb6f62b68ed6b7cc6c676 | Bin 146 -> 0 bytes .../a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 | Bin 21 -> 0 bytes .../d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 | 2 - .../d1/5e253139400c94b42fc266641d1698720d4ecf | 2 - .../e5/c5c5583f49a34e86ce622b59363df99e09d4c6 | Bin 30 -> 0 bytes .../e7/76522ac28860d2eba6fe98fa4fad67e798419a | Bin 127 -> 0 bytes .../f6/77ef8a14ca2770e48129cc13acfa1c369908cc | 3 - .../repo/.git_keep/refs/heads/branch2 | 1 - .../expected/repo/.git_keep/refs/heads/master | 1 - test/integration/diffing/expected/repo/file0 | 1 - test/integration/diffing/expected/repo/file1 | 1 - test/integration/diffing/expected/repo/file2 | 1 - test/integration/diffing/expected/repo/file4 | 1 - test/integration/diffing/recording.json | 1 - test/integration/diffing/setup.sh | 40 ---------- test/integration/diffing/test.json | 1 - .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../expected/repo/.git_keep/FETCH_HEAD | 0 .../diffing2/expected/repo/.git_keep/HEAD | 1 - .../diffing2/expected/repo/.git_keep/config | 10 --- .../expected/repo/.git_keep/description | 1 - .../diffing2/expected/repo/.git_keep/index | Bin 353 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 7 -- .../expected/repo/.git_keep/logs/HEAD | 9 --- .../repo/.git_keep/logs/refs/heads/branch2 | 5 -- .../repo/.git_keep/logs/refs/heads/master | 4 - .../06/da465196938ea235323950ee451ffb36a431cf | Bin 148 -> 0 bytes .../08/04f2069f5af172770da3d231be982ca320bf8b | Bin 145 -> 0 bytes .../0c/2aa38e0600e0d2df09c2f84664d8a14f899879 | Bin 36 -> 0 bytes .../18/0cf8328022becee9aaa2577a8f84ea2b9f3827 | Bin 21 -> 0 bytes .../1b/74d64fe4055d4502ac600072586068b27d4aa7 | 3 - .../1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 | Bin 50 -> 0 bytes .../2d/00bd505971a8bc7318d98e003aee708a367c85 | Bin 24 -> 0 bytes .../38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da | Bin 21 -> 0 bytes .../3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a | Bin 31 -> 0 bytes .../3d/b2086f780b1cf632eec29111ef395913a8ab2b | Bin 127 -> 0 bytes .../59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 | Bin 126 -> 0 bytes .../6d/04f5ed53b383c0a4c63cac168df557b6df1e44 | Bin 147 -> 0 bytes .../7b/f3d13079ced18f5b00e29c48c777e23f687d0a | Bin 118 -> 0 bytes .../8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 | Bin 127 -> 0 bytes .../9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c | Bin 101 -> 0 bytes .../a1/1d868e88adb55a48fc55ee1377b3255c0cd329 | Bin 148 -> 0 bytes .../a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 | Bin 21 -> 0 bytes .../c6/756882cc166f52b096a5e4fb9e4f5d507870c8 | Bin 146 -> 0 bytes .../d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 | 2 - .../e5/c5c5583f49a34e86ce622b59363df99e09d4c6 | Bin 30 -> 0 bytes .../e7/76522ac28860d2eba6fe98fa4fad67e798419a | Bin 127 -> 0 bytes .../e8/76c3dfe2826621bea1bd3c87c2b9e2be88e69e | Bin 147 -> 0 bytes .../repo/.git_keep/refs/heads/branch2 | 1 - .../expected/repo/.git_keep/refs/heads/master | 1 - test/integration/diffing2/expected/repo/file0 | 1 - test/integration/diffing2/expected/repo/file1 | 1 - test/integration/diffing2/expected/repo/file2 | 1 - test/integration/diffing2/expected/repo/file4 | 1 - test/integration/diffing2/recording.json | 1 - test/integration/diffing2/setup.sh | 40 ---------- test/integration/diffing2/test.json | 1 - .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../expected/repo/.git_keep/FETCH_HEAD | 0 .../diffing3/expected/repo/.git_keep/HEAD | 1 - .../diffing3/expected/repo/.git_keep/config | 10 --- .../expected/repo/.git_keep/description | 1 - .../diffing3/expected/repo/.git_keep/index | Bin 281 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 7 -- .../expected/repo/.git_keep/logs/HEAD | 9 --- .../repo/.git_keep/logs/refs/heads/branch2 | 5 -- .../repo/.git_keep/logs/refs/heads/master | 4 - .../0c/2aa38e0600e0d2df09c2f84664d8a14f899879 | Bin 36 -> 0 bytes .../13/d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 | 2 - .../18/0cf8328022becee9aaa2577a8f84ea2b9f3827 | Bin 21 -> 0 bytes .../1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 | Bin 50 -> 0 bytes .../1e/dd26fd03ee6243bd1513788874c6c57ef1d41a | 2 - .../27/5e6a821120c07a9068a9701ed14a82eeed3117 | 2 - .../2d/00bd505971a8bc7318d98e003aee708a367c85 | Bin 24 -> 0 bytes .../38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da | Bin 21 -> 0 bytes .../3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a | Bin 31 -> 0 bytes .../3d/b2086f780b1cf632eec29111ef395913a8ab2b | Bin 127 -> 0 bytes .../4e/2d07409901af28a47f5d3b126953a5fb8b36ee | 3 - .../57/695899c35539821690c4c132bd0e872a01c192 | Bin 147 -> 0 bytes .../59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 | Bin 126 -> 0 bytes .../8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 | Bin 127 -> 0 bytes .../93/b73046d6820607f1da09399b55a145d5389ab8 | Bin 146 -> 0 bytes .../9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c | Bin 101 -> 0 bytes .../a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 | Bin 21 -> 0 bytes .../b2/5b8446022fb5fcded2bab1ed2b02828a5c4d0b | Bin 148 -> 0 bytes .../d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 | 2 - .../e5/c5c5583f49a34e86ce622b59363df99e09d4c6 | Bin 30 -> 0 bytes .../e7/76522ac28860d2eba6fe98fa4fad67e798419a | Bin 127 -> 0 bytes .../ff/b13702e6bc59e2806bc3a5f93500e46925b131 | Bin 147 -> 0 bytes .../repo/.git_keep/refs/heads/branch2 | 1 - .../expected/repo/.git_keep/refs/heads/master | 1 - test/integration/diffing3/expected/repo/file0 | 1 - test/integration/diffing3/expected/repo/file1 | 1 - test/integration/diffing3/expected/repo/file2 | 1 - test/integration/diffing3/recording.json | 1 - test/integration/diffing3/setup.sh | 40 ---------- test/integration/diffing3/test.json | 1 - 127 files changed, 203 insertions(+), 282 deletions(-) create mode 100644 pkg/integration/tests/diff/diff.go create mode 100644 pkg/integration/tests/diff/diff_and_apply_patch.go create mode 100644 pkg/integration/tests/diff/diff_commits.go delete mode 100644 test/integration/diffing/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/diffing/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/diffing/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/diffing/expected/repo/.git_keep/config delete mode 100644 test/integration/diffing/expected/repo/.git_keep/description delete mode 100644 test/integration/diffing/expected/repo/.git_keep/index delete mode 100644 test/integration/diffing/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/diffing/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/branch2 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/05/19814b4923f4639f1a47348b1539e3c5c54904 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/14/4da8a531224129210249f43dded86056891506 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/3d/b2086f780b1cf632eec29111ef395913a8ab2b delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/57/51731b38a36f8eb54a4bb304522ca539e04522 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/75/b31f81dd4387724638dbd3aff7380155c672cd delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/96/a6d041bbb131df0e74d179c3adcd2ace0e7f9c delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/a1/00b407f33fd2e97a3cb6f62b68ed6b7cc6c676 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/d1/5e253139400c94b42fc266641d1698720d4ecf delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a delete mode 100644 test/integration/diffing/expected/repo/.git_keep/objects/f6/77ef8a14ca2770e48129cc13acfa1c369908cc delete mode 100644 test/integration/diffing/expected/repo/.git_keep/refs/heads/branch2 delete mode 100644 test/integration/diffing/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration/diffing/expected/repo/file0 delete mode 100644 test/integration/diffing/expected/repo/file1 delete mode 100644 test/integration/diffing/expected/repo/file2 delete mode 100644 test/integration/diffing/expected/repo/file4 delete mode 100644 test/integration/diffing/recording.json delete mode 100644 test/integration/diffing/setup.sh delete mode 100644 test/integration/diffing/test.json delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/config delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/description delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/index delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/branch2 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/06/da465196938ea235323950ee451ffb36a431cf delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/08/04f2069f5af172770da3d231be982ca320bf8b delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/1b/74d64fe4055d4502ac600072586068b27d4aa7 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/3d/b2086f780b1cf632eec29111ef395913a8ab2b delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/6d/04f5ed53b383c0a4c63cac168df557b6df1e44 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/7b/f3d13079ced18f5b00e29c48c777e23f687d0a delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/a1/1d868e88adb55a48fc55ee1377b3255c0cd329 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/c6/756882cc166f52b096a5e4fb9e4f5d507870c8 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/objects/e8/76c3dfe2826621bea1bd3c87c2b9e2be88e69e delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/refs/heads/branch2 delete mode 100644 test/integration/diffing2/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration/diffing2/expected/repo/file0 delete mode 100644 test/integration/diffing2/expected/repo/file1 delete mode 100644 test/integration/diffing2/expected/repo/file2 delete mode 100644 test/integration/diffing2/expected/repo/file4 delete mode 100644 test/integration/diffing2/recording.json delete mode 100644 test/integration/diffing2/setup.sh delete mode 100644 test/integration/diffing2/test.json delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/config delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/description delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/index delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/branch2 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/13/d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/1e/dd26fd03ee6243bd1513788874c6c57ef1d41a delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/27/5e6a821120c07a9068a9701ed14a82eeed3117 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/38/143ad4a0fe2ab6ee53c2ef89a5d9e2bd9535da delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/3d/b2086f780b1cf632eec29111ef395913a8ab2b delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/4e/2d07409901af28a47f5d3b126953a5fb8b36ee delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/57/695899c35539821690c4c132bd0e872a01c192 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/93/b73046d6820607f1da09399b55a145d5389ab8 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/b2/5b8446022fb5fcded2bab1ed2b02828a5c4d0b delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/objects/ff/b13702e6bc59e2806bc3a5f93500e46925b131 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/refs/heads/branch2 delete mode 100644 test/integration/diffing3/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration/diffing3/expected/repo/file0 delete mode 100644 test/integration/diffing3/expected/repo/file1 delete mode 100644 test/integration/diffing3/expected/repo/file2 delete mode 100644 test/integration/diffing3/recording.json delete mode 100644 test/integration/diffing3/setup.sh delete mode 100644 test/integration/diffing3/test.json diff --git a/pkg/integration/components/assert.go b/pkg/integration/components/assert.go index 65e3e6ec9..c1ae4cdd2 100644 --- a/pkg/integration/components/assert.go +++ b/pkg/integration/components/assert.go @@ -192,6 +192,13 @@ func (self *Assert) InMenu() { }) } +func (self *Assert) NotInPopup() { + self.assertWithRetries(func() (bool, string) { + currentViewName := self.gui.CurrentContext().GetView().Name() + return currentViewName != "menu" && currentViewName != "confirmation" && currentViewName != "commitMessage", "Expected popup not to be focused" + }) +} + func (self *Assert) MatchCurrentViewTitle(matcher *matcher) { self.matchString(matcher, "Unexpected current view title.", func() string { diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go new file mode 100644 index 000000000..9c23674a4 --- /dev/null +++ b/pkg/integration/tests/diff/diff.go @@ -0,0 +1,62 @@ +package diff + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var Diff = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "View the diff of two branches, then view the reverse diff", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.NewBranch("branch-a") + shell.CreateFileAndAdd("file1", "first line") + shell.Commit("first commit") + + shell.NewBranch("branch-b") + shell.UpdateFileAndAdd("file1", "first line\nsecond line") + shell.Commit("update") + + shell.Checkout("branch-a") + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + input.SwitchToBranchesWindow() + assert.CurrentViewName("localBranches") + + assert.MatchSelectedLine(Contains("branch-a")) + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + assert.MatchCurrentViewTitle(Equals("Diffing")) + assert.MatchSelectedLine(Contains("diff branch-a")) + input.Confirm() + + assert.CurrentViewName("localBranches") + + assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-a")) + input.NextItem() + assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b")) + assert.MatchMainViewContent(Contains("+second line")) + + input.Enter() + assert.CurrentViewName("subCommits") + assert.MatchMainViewContent(Contains("+second line")) + assert.MatchSelectedLine(Contains("update")) + input.Enter() + assert.CurrentViewName("commitFiles") + assert.MatchSelectedLine(Contains("file1")) + assert.MatchMainViewContent(Contains("+second line")) + + input.PressKeys(keys.Universal.Return) + input.PressKeys(keys.Universal.Return) + assert.CurrentViewName("localBranches") + + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + input.NavigateToListItemContainingText("reverse diff direction") + input.Confirm() + assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b -R")) + assert.MatchMainViewContent(Contains("-second line")) + }, +}) diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go new file mode 100644 index 000000000..7c27b1517 --- /dev/null +++ b/pkg/integration/tests/diff/diff_and_apply_patch.go @@ -0,0 +1,74 @@ +package diff + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Create a patch from the diff between two branches and apply the patch.", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.NewBranch("branch-a") + shell.CreateFileAndAdd("file1", "first line\n") + shell.Commit("first commit") + + shell.NewBranch("branch-b") + shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") + shell.Commit("update") + + shell.Checkout("branch-a") + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + input.SwitchToBranchesWindow() + assert.CurrentViewName("localBranches") + + assert.MatchSelectedLine(Contains("branch-a")) + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + assert.MatchCurrentViewTitle(Equals("Diffing")) + assert.MatchSelectedLine(Contains("diff branch-a")) + input.Confirm() + + assert.CurrentViewName("localBranches") + + assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-a")) + input.NextItem() + assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b")) + assert.MatchMainViewContent(Contains("+second line")) + + input.Enter() + assert.CurrentViewName("subCommits") + assert.MatchMainViewContent(Contains("+second line")) + assert.MatchSelectedLine(Contains("update")) + input.Enter() + assert.CurrentViewName("commitFiles") + assert.MatchSelectedLine(Contains("file1")) + assert.MatchMainViewContent(Contains("+second line")) + + // add the file to the patch + input.PrimaryAction() + + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + assert.MatchCurrentViewTitle(Equals("Diffing")) + input.NavigateToListItemContainingText("exit diff mode") + input.Confirm() + + assert.MatchViewContent("information", NotContains("building patch")) + + input.PressKeys(keys.Universal.CreatePatchOptionsMenu) + assert.InMenu() + assert.MatchCurrentViewTitle(Equals("Patch Options")) + // including the keybinding 'a' here to distinguish the menu item from the 'apply patch in reverse' item + input.NavigateToListItemContainingText("a apply patch") + input.Confirm() + + input.SwitchToFilesWindow() + + assert.MatchSelectedLine(Contains("file1")) + assert.MatchMainViewContent(Contains("+second line")) + }, +}) diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go new file mode 100644 index 000000000..bcf83d5c5 --- /dev/null +++ b/pkg/integration/tests/diff/diff_commits.go @@ -0,0 +1,56 @@ +package diff + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "View the diff between two commits", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file1", "first line\n") + shell.Commit("first commit") + shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") + shell.Commit("second commit") + shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n") + shell.Commit("third commit") + }, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + input.SwitchToCommitsWindow() + assert.CurrentViewName("commits") + + assert.MatchSelectedLine(Contains("third commit")) + + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + assert.MatchCurrentViewTitle(Equals("Diffing")) + assert.MatchSelectedLine(Contains("diff")) + input.Confirm() + assert.NotInPopup() + + assert.MatchViewContent("information", Contains("showing output for: git diff")) + + input.NextItem() + input.NextItem() + + assert.MatchSelectedLine(Contains("first commit")) + + assert.MatchMainViewContent(Contains("-second line\n-third line")) + + input.PressKeys(keys.Universal.DiffingMenu) + assert.InMenu() + input.NavigateToListItemContainingText("reverse diff direction") + input.Confirm() + + assert.MatchMainViewContent(Contains("+second line\n+third line")) + + input.Enter() + + assert.CurrentViewName("commitFiles") + assert.MatchSelectedLine(Contains("file1")) + assert.MatchMainViewContent(Contains("+second line\n+third line")) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 3feeb2d81..53961363e 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -16,6 +16,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/commit" "github.com/jesseduffield/lazygit/pkg/integration/tests/config" "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" + "github.com/jesseduffield/lazygit/pkg/integration/tests/diff" "github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" "github.com/jesseduffield/lazygit/pkg/integration/tests/misc" @@ -57,6 +58,9 @@ var tests = []*components.IntegrationTest{ stash.Stash, stash.StashIncludingUntrackedFiles, config.RemoteNamedStar, + diff.Diff, + diff.DiffAndApplyPatch, + diff.DiffCommits, } func GetTests() []*components.IntegrationTest { diff --git a/test/integration/diffing/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/diffing/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 9daeafb98..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/test/integration/diffing/expected/repo/.git_keep/FETCH_HEAD b/test/integration/diffing/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/diffing/expected/repo/.git_keep/HEAD b/test/integration/diffing/expected/repo/.git_keep/HEAD deleted file mode 100644 index 1d57c9ea7..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/branch2 diff --git a/test/integration/diffing/expected/repo/.git_keep/config b/test/integration/diffing/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/diffing/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/diffing/expected/repo/.git_keep/description b/test/integration/diffing/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/diffing/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/diffing/expected/repo/.git_keep/index b/test/integration/diffing/expected/repo/.git_keep/index deleted file mode 100644 index a119ab59ee46d59891bff4962a564b195906f617..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 353 zcmZ?q402{*U|<4bmW1pZ8_YL){DaYqKruEw_G$)(#w834j9-CjM1YvhLd5FIf`3}u z-UT0e-?{YWqrFp2Z!xf@W#*(B0HqliK>96?tyu@7q2^3NH)rXd$A48*Z+wXejpE67 zx)9*i(tQsP9lYru^?~MqX^1%-Ea>J)@cb}pP}+Cy<*G&DRsAimwC7u>L(DNk zm~*7J6KoEUhML2UW)7z=!`^_%!WDapC2saHSiLLgGOKBYm}3GqCnU(#708feFi|kz vid^t!#>1AH<+_KXt9I=0530`k)L>I9yW-f>1!X5E@!Wq~a diff --git a/test/integration/diffing/expected/repo/.git_keep/info/exclude b/test/integration/diffing/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/diffing/expected/repo/.git_keep/logs/HEAD b/test/integration/diffing/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 6d2ab7ba5..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,9 +0,0 @@ -0000000000000000000000000000000000000000 5751731b38a36f8eb54a4bb304522ca539e04522 CI 1617680560 +1000 commit (initial): file0 -5751731b38a36f8eb54a4bb304522ca539e04522 d15e253139400c94b42fc266641d1698720d4ecf CI 1617680560 +1000 commit: file1 -d15e253139400c94b42fc266641d1698720d4ecf 0519814b4923f4639f1a47348b1539e3c5c54904 CI 1617680560 +1000 commit: file2 -0519814b4923f4639f1a47348b1539e3c5c54904 144da8a531224129210249f43dded86056891506 CI 1617680561 +1000 commit: file4 -144da8a531224129210249f43dded86056891506 144da8a531224129210249f43dded86056891506 CI 1617680561 +1000 checkout: moving from master to branch2 -144da8a531224129210249f43dded86056891506 96a6d041bbb131df0e74d179c3adcd2ace0e7f9c CI 1617680561 +1000 commit: file4 -96a6d041bbb131df0e74d179c3adcd2ace0e7f9c 75b31f81dd4387724638dbd3aff7380155c672cd CI 1617680561 +1000 commit: file4 -75b31f81dd4387724638dbd3aff7380155c672cd f677ef8a14ca2770e48129cc13acfa1c369908cc CI 1617680561 +1000 commit: file2 -f677ef8a14ca2770e48129cc13acfa1c369908cc a100b407f33fd2e97a3cb6f62b68ed6b7cc6c676 CI 1617680570 +1000 commit: test diff --git a/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/branch2 b/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/branch2 deleted file mode 100644 index ea8f0f0b7..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/branch2 +++ /dev/null @@ -1,5 +0,0 @@ -0000000000000000000000000000000000000000 144da8a531224129210249f43dded86056891506 CI 1617680561 +1000 branch: Created from HEAD -144da8a531224129210249f43dded86056891506 96a6d041bbb131df0e74d179c3adcd2ace0e7f9c CI 1617680561 +1000 commit: file4 -96a6d041bbb131df0e74d179c3adcd2ace0e7f9c 75b31f81dd4387724638dbd3aff7380155c672cd CI 1617680561 +1000 commit: file4 -75b31f81dd4387724638dbd3aff7380155c672cd f677ef8a14ca2770e48129cc13acfa1c369908cc CI 1617680561 +1000 commit: file2 -f677ef8a14ca2770e48129cc13acfa1c369908cc a100b407f33fd2e97a3cb6f62b68ed6b7cc6c676 CI 1617680570 +1000 commit: test diff --git a/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 7427bd7e9..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 5751731b38a36f8eb54a4bb304522ca539e04522 CI 1617680560 +1000 commit (initial): file0 -5751731b38a36f8eb54a4bb304522ca539e04522 d15e253139400c94b42fc266641d1698720d4ecf CI 1617680560 +1000 commit: file1 -d15e253139400c94b42fc266641d1698720d4ecf 0519814b4923f4639f1a47348b1539e3c5c54904 CI 1617680560 +1000 commit: file2 -0519814b4923f4639f1a47348b1539e3c5c54904 144da8a531224129210249f43dded86056891506 CI 1617680561 +1000 commit: file4 diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/05/19814b4923f4639f1a47348b1539e3c5c54904 b/test/integration/diffing/expected/repo/.git_keep/objects/05/19814b4923f4639f1a47348b1539e3c5c54904 deleted file mode 100644 index dc7f756ddc38b7d90d284efef86797087b88c273..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0Brww0gaAJ3c@fDKwak)*$Xl=&1V84LRURTI+C5hnTAz@J+73HT_C8Ke{pPl>dXud^EQT}B-~-qz0)RQ`Io0(~-PC1OGCycOIW+cn BLk<7{ diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 b/test/integration/diffing/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 deleted file mode 100644 index 38acaeff2c4712a28ba59b99a0ddd33f70433acf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36 ucmV+<0Nej~0ZYosPf{?lWXQ?POI66vOXUJHO3L%0jEthxR4xGKxeQfIM-lJ< diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/14/4da8a531224129210249f43dded86056891506 b/test/integration/diffing/expected/repo/.git_keep/objects/14/4da8a531224129210249f43dded86056891506 deleted file mode 100644 index f0e0252c6..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/objects/14/4da8a531224129210249f43dded86056891506 +++ /dev/null @@ -1,2 +0,0 @@ -xA -0@Q9EdI2"BW=$N`l)<=[ OcWieR UKBEKəMv}"0d s@*kFdF>vuR~ 'r1=s'7my)8N \ No newline at end of file diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/diffing/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 deleted file mode 100644 index f74bf2335bbc5999ad0faff94fb04165d8ab5c7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb~ZE#08nZNMgRZ+ diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 b/test/integration/diffing/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 deleted file mode 100644 index 79fcadf67fdecb0f0cffca7ff27b2ae5c031e4d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmV-20L}k+0V^p=O;s>9W-v4`Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U I033l4YT~68jQ{`u diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 b/test/integration/diffing/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 deleted file mode 100644 index d4270c258e5362e874f0cd17fc6c260a82c41501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 gcmb|y2)08mZ`J^%m! diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a b/test/integration/diffing/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a deleted file mode 100644 index 65140e8b7c0189f1a7f6fc780332ce07230ba16e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmb7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKH+(OTTc#_-_Mea=Ha+){2V^zWQe2>@J}IUIERJ#_#8 diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/57/51731b38a36f8eb54a4bb304522ca539e04522 b/test/integration/diffing/expected/repo/.git_keep/objects/57/51731b38a36f8eb54a4bb304522ca539e04522 deleted file mode 100644 index 802ec41550f19832979198dd97dff75c50723467..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 118 zcmV-+0Ez#20gcT;3c@fDMq$@E#q0%{iPNM35uvLdBWeC%p&_M2@c8x!ZXX}KrPaE2 z64gsT0218cdrapK*` YgJZf1Gn=!Xla4>RDeDF{Kid;4>cEOP`v3p{ diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 b/test/integration/diffing/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 deleted file mode 100644 index ed50454974ab7775c9d85cee55477580ac83e835..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmV-^0D=E_0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F gDKKHsW!M`KS-4_PvBb?j2CH`kU1l|{09GbA0`7u1ssI20 diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/75/b31f81dd4387724638dbd3aff7380155c672cd b/test/integration/diffing/expected/repo/.git_keep/objects/75/b31f81dd4387724638dbd3aff7380155c672cd deleted file mode 100644 index e14a460c2804693555c093df93c7823ef6f7b6ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmV;F0Biqv0gcX03c@fDKw;N8#q0%{N!t8?h|pD!F_}!T(AZKUczk;Vw;yluWNU5d zK*?VEp$e{Ki_zB*F_Tp9tg6^VL|R=M6FH8YZ8kd}`tFcC`+@`IoXJtCs9`7+k~l6> zEQ_8}lNkQ=*LJ`(!+n~c`sKE-dXud^fII~sar6XNLPT@wIo0*g+|*^&!TbQW`Z_fF CElPC& diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 b/test/integration/diffing/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 deleted file mode 100644 index 2920ab335181ed440a54f52297d3cb1ab3a70222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmV-_0D%8^0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKGpdh}?7z2{=TwsT3^k!H3(=W$*+1^{g9Id)YJJaPa4 diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/96/a6d041bbb131df0e74d179c3adcd2ace0e7f9c b/test/integration/diffing/expected/repo/.git_keep/objects/96/a6d041bbb131df0e74d179c3adcd2ace0e7f9c deleted file mode 100644 index 5f97ec479b939f37ff848f632b4e9524a6c93cd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 146 zcmV;D0B!$x0gaA93d0}}0DJZo-V4QDchx{Cg`Dz?jc#ZlHX&H(^Xn6O9cEziUhCQ{ z40vg$s!d9HcDZmUG4U)!gu*jAjiOwXMZJ&c%^|10dq`9y341^!zyZM_4GZ~Fw4~rT zqyg9kBcJx#PdiTbK2A^lNw9bEeZi)$~u@EbFFZe*DQeS+#~k AX8-^I diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c b/test/integration/diffing/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c deleted file mode 100644 index 0e95eb06dda15fe1901a7942e7954b700b36bfa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmV-r0Gj`J0V^p=O;xb8WH2-^Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U zND2%YmhO4{S2gv2WLwJR>kD diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/a1/00b407f33fd2e97a3cb6f62b68ed6b7cc6c676 b/test/integration/diffing/expected/repo/.git_keep/objects/a1/00b407f33fd2e97a3cb6f62b68ed6b7cc6c676 deleted file mode 100644 index 8c6e41957e9f9a187abe5fecf98f3cd6ea2da35a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 146 zcmV;D0B!$x0gcW<3c@fDKvCB@MfQTsq)BE1B0^U^#$=qJU~Q=pJia}G+s|8kUFP}G zJr+Fl&CI7FU|QIaBdJih>5wW(<;t<8Ks8GX3~rUpUfs7$WQ_%*N+1G@jG?IFAld|V z$fW?QI{EbbviWiH=W)8)SLXF;Ctc=?$BdL25`jM=0Jy#GQ{DdLuG_o2A7m>zv>e?@ A{{R30 diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/diffing/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5fbab12262e28d85e78af8a31cd0024c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb`~^A08nuUMF0Q* diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 b/test/integration/diffing/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 deleted file mode 100644 index 2e9066287..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 +++ /dev/null @@ -1,2 +0,0 @@ -x+)JMU03c040031QHI5`ֶww.hT[H - yW5Ɨ(| ^-W(x9 \ No newline at end of file diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/d1/5e253139400c94b42fc266641d1698720d4ecf b/test/integration/diffing/expected/repo/.git_keep/objects/d1/5e253139400c94b42fc266641d1698720d4ecf deleted file mode 100644 index e6f554e7f..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/objects/d1/5e253139400c94b42fc266641d1698720d4ecf +++ /dev/null @@ -1,2 +0,0 @@ -xK -0@)f_(3Rp1&HSER+=Aw[ @Qqe%x8Z=a|Mzb!"\ iϩf^V%Hr8 \ No newline at end of file diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 b/test/integration/diffing/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 deleted file mode 100644 index 01ce23cee261a5c479d905ee8318e897bf4bca8f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 mcmb~-q%PKJUL9GL*(lMbH% diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a b/test/integration/diffing/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a deleted file mode 100644 index 08edf28f3f282798a9dd14ae1222a66d0c4a783a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmV-_0D%8^0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%^C{T5hys-jyt=kDGjX{j7V6OEbKX h6qqpZXf5tzV|Z}sKIfqyZYehw`ghK#1OQ99IE)E{Iurl^ diff --git a/test/integration/diffing/expected/repo/.git_keep/objects/f6/77ef8a14ca2770e48129cc13acfa1c369908cc b/test/integration/diffing/expected/repo/.git_keep/objects/f6/77ef8a14ca2770e48129cc13acfa1c369908cc deleted file mode 100644 index 1380ed286..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/objects/f6/77ef8a14ca2770e48129cc13acfa1c369908cc +++ /dev/null @@ -1,3 +0,0 @@ -xM -0@a9Ed33cLR"x|{o- UD`Ձ*Ii]}wKiPJ|e.AjRH>#;N>NOJW=, K -9sseUo~b,9O \ No newline at end of file diff --git a/test/integration/diffing/expected/repo/.git_keep/refs/heads/branch2 b/test/integration/diffing/expected/repo/.git_keep/refs/heads/branch2 deleted file mode 100644 index dcc322cf6..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/refs/heads/branch2 +++ /dev/null @@ -1 +0,0 @@ -a100b407f33fd2e97a3cb6f62b68ed6b7cc6c676 diff --git a/test/integration/diffing/expected/repo/.git_keep/refs/heads/master b/test/integration/diffing/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index bb48ea2cc..000000000 --- a/test/integration/diffing/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -144da8a531224129210249f43dded86056891506 diff --git a/test/integration/diffing/expected/repo/file0 b/test/integration/diffing/expected/repo/file0 deleted file mode 100644 index 38143ad4a..000000000 --- a/test/integration/diffing/expected/repo/file0 +++ /dev/null @@ -1 +0,0 @@ -test0 diff --git a/test/integration/diffing/expected/repo/file1 b/test/integration/diffing/expected/repo/file1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/diffing/expected/repo/file1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/diffing/expected/repo/file2 b/test/integration/diffing/expected/repo/file2 deleted file mode 100644 index 180cf8328..000000000 --- a/test/integration/diffing/expected/repo/file2 +++ /dev/null @@ -1 +0,0 @@ -test2 diff --git a/test/integration/diffing/expected/repo/file4 b/test/integration/diffing/expected/repo/file4 deleted file mode 100644 index 2d00bd505..000000000 --- a/test/integration/diffing/expected/repo/file4 +++ /dev/null @@ -1 +0,0 @@ -line one diff --git a/test/integration/diffing/recording.json b/test/integration/diffing/recording.json deleted file mode 100644 index e3e075780..000000000 --- a/test/integration/diffing/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":497,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1570,"Mod":0,"Key":256,"Ch":87},{"Timestamp":1882,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2258,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2514,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3602,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5057,"Mod":0,"Key":256,"Ch":32},{"Timestamp":5250,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5410,"Mod":0,"Key":256,"Ch":32},{"Timestamp":6010,"Mod":2,"Key":16,"Ch":16},{"Timestamp":6730,"Mod":0,"Key":258,"Ch":0},{"Timestamp":7106,"Mod":0,"Key":13,"Ch":13},{"Timestamp":8090,"Mod":0,"Key":260,"Ch":0},{"Timestamp":8330,"Mod":0,"Key":256,"Ch":99},{"Timestamp":8545,"Mod":0,"Key":256,"Ch":116},{"Timestamp":8601,"Mod":0,"Key":256,"Ch":101},{"Timestamp":8778,"Mod":0,"Key":256,"Ch":115},{"Timestamp":8809,"Mod":0,"Key":256,"Ch":116},{"Timestamp":9074,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9722,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/diffing/setup.sh b/test/integration/diffing/setup.sh deleted file mode 100644 index 4cd444a1f..000000000 --- a/test/integration/diffing/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test0 > file0 -git add . -git commit -am file0 - -echo test1 > file1 -git add . -git commit -am file1 - -echo test2 > file2 -git add . -git commit -am file2 - -echo "line one" > file4 -git add . -git commit -am file4 - -git checkout -b branch2 - -echo "line two" >> file4 -git add . -git commit -am file4 - -echo "line three" >> file4 -git add . -git commit -am file4 - -echo "line two" >> file2 -git add . -git commit -am file2 diff --git a/test/integration/diffing/test.json b/test/integration/diffing/test.json deleted file mode 100644 index 8ffc90df2..000000000 --- a/test/integration/diffing/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "diffing two branches and making a patch from their diff files", "speed": 10 } diff --git a/test/integration/diffing2/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/diffing2/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index d72af3146..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -asd diff --git a/test/integration/diffing2/expected/repo/.git_keep/FETCH_HEAD b/test/integration/diffing2/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/diffing2/expected/repo/.git_keep/HEAD b/test/integration/diffing2/expected/repo/.git_keep/HEAD deleted file mode 100644 index 1d57c9ea7..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/branch2 diff --git a/test/integration/diffing2/expected/repo/.git_keep/config b/test/integration/diffing2/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/diffing2/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/diffing2/expected/repo/.git_keep/description b/test/integration/diffing2/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/diffing2/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/diffing2/expected/repo/.git_keep/index b/test/integration/diffing2/expected/repo/.git_keep/index deleted file mode 100644 index f8944878d5ee77536fd35c0bbaff0b52cb81b43d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 353 zcmZ?q402{*U|<4bmW1q^+|r-atY9=FP>fBFuZMx5aR~zh<5!>>5g=x>5V5+l;GfpE zcfp6=cP_p8Xzx_hTMVpenK`KjKxqaBkbYUg*~~B+YR+PGbC<{8u&g#+QiDD4u+$ z3jtm&-B%&z7{bgEF=ZFJ1~dmuL(JiqKsQH%=Z8^)(!O&qS1k&!>Th|aJ>NndVvZ5Q zoC3jjU~_;p)EsFvb2xPw_69^2uGmv7akG!X>RmyXSxqa%922lPAwjOLK!zlPiGl%F v 1617680651 +1000 commit (initial): file0 -7bf3d13079ced18f5b00e29c48c777e23f687d0a e876c3dfe2826621bea1bd3c87c2b9e2be88e69e CI 1617680651 +1000 commit: file1 -e876c3dfe2826621bea1bd3c87c2b9e2be88e69e c6756882cc166f52b096a5e4fb9e4f5d507870c8 CI 1617680651 +1000 commit: file2 -c6756882cc166f52b096a5e4fb9e4f5d507870c8 06da465196938ea235323950ee451ffb36a431cf CI 1617680651 +1000 commit: file4 -06da465196938ea235323950ee451ffb36a431cf 06da465196938ea235323950ee451ffb36a431cf CI 1617680651 +1000 checkout: moving from master to branch2 -06da465196938ea235323950ee451ffb36a431cf 6d04f5ed53b383c0a4c63cac168df557b6df1e44 CI 1617680651 +1000 commit: file4 -6d04f5ed53b383c0a4c63cac168df557b6df1e44 a11d868e88adb55a48fc55ee1377b3255c0cd329 CI 1617680651 +1000 commit: file4 -a11d868e88adb55a48fc55ee1377b3255c0cd329 1b74d64fe4055d4502ac600072586068b27d4aa7 CI 1617680651 +1000 commit: file2 -1b74d64fe4055d4502ac600072586068b27d4aa7 0804f2069f5af172770da3d231be982ca320bf8b CI 1617680662 +1000 commit: asd diff --git a/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/branch2 b/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/branch2 deleted file mode 100644 index a67589ac2..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/branch2 +++ /dev/null @@ -1,5 +0,0 @@ -0000000000000000000000000000000000000000 06da465196938ea235323950ee451ffb36a431cf CI 1617680651 +1000 branch: Created from HEAD -06da465196938ea235323950ee451ffb36a431cf 6d04f5ed53b383c0a4c63cac168df557b6df1e44 CI 1617680651 +1000 commit: file4 -6d04f5ed53b383c0a4c63cac168df557b6df1e44 a11d868e88adb55a48fc55ee1377b3255c0cd329 CI 1617680651 +1000 commit: file4 -a11d868e88adb55a48fc55ee1377b3255c0cd329 1b74d64fe4055d4502ac600072586068b27d4aa7 CI 1617680651 +1000 commit: file2 -1b74d64fe4055d4502ac600072586068b27d4aa7 0804f2069f5af172770da3d231be982ca320bf8b CI 1617680662 +1000 commit: asd diff --git a/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index c435fd1a6..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 7bf3d13079ced18f5b00e29c48c777e23f687d0a CI 1617680651 +1000 commit (initial): file0 -7bf3d13079ced18f5b00e29c48c777e23f687d0a e876c3dfe2826621bea1bd3c87c2b9e2be88e69e CI 1617680651 +1000 commit: file1 -e876c3dfe2826621bea1bd3c87c2b9e2be88e69e c6756882cc166f52b096a5e4fb9e4f5d507870c8 CI 1617680651 +1000 commit: file2 -c6756882cc166f52b096a5e4fb9e4f5d507870c8 06da465196938ea235323950ee451ffb36a431cf CI 1617680651 +1000 commit: file4 diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/06/da465196938ea235323950ee451ffb36a431cf b/test/integration/diffing2/expected/repo/.git_keep/objects/06/da465196938ea235323950ee451ffb36a431cf deleted file mode 100644 index d7e70107c4b2682bcf55bbbce069ea05967ff077..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmV;F0Biqv0gaA93c@fDMP26<*$Xm>$z%c|LRUS;WIDluv86=t_~r<1{^Gs2__DRO zcI&b~^+VOh%%GA<9fc&E{36#_5*I2IYV@ffS5IJeKJ?wKV2ViOMI7Sr1u}BfP)i;Y zmk5ax2pRtL=XTg>wzp}1=$G66(u-{EZXLRW1Q?w?I{+|)j#FL#%uQWi8q5!5BRNmg Cdq%bZ diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/08/04f2069f5af172770da3d231be982ca320bf8b b/test/integration/diffing2/expected/repo/.git_keep/objects/08/04f2069f5af172770da3d231be982ca320bf8b deleted file mode 100644 index eea371cdcf02ff0a3f485b67346b44cc7b67d3aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 145 zcmV;C0B-+y0gaA93c@fD06pgwxeKz1$?g_Jgr540O|nJ7*b*c7eDega!wgK`YJGI; zCOGt_YU3oJd17@OC=2rS4BX<*i<=Lr2Jf=~ZE#08nZNMgRZ+ diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/1b/74d64fe4055d4502ac600072586068b27d4aa7 b/test/integration/diffing2/expected/repo/.git_keep/objects/1b/74d64fe4055d4502ac600072586068b27d4aa7 deleted file mode 100644 index 16181d57a..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/objects/1b/74d64fe4055d4502ac600072586068b27d4aa7 +++ /dev/null @@ -1,3 +0,0 @@ -x1 -0 @>BHBCeH\#tm]!fbdBԌ" -ڤ\-Iվjh1IIݮW",&e"^j&2.ƩCr09vaa|W}[և_!zN5:/?9 \ No newline at end of file diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 b/test/integration/diffing2/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 deleted file mode 100644 index 79fcadf67fdecb0f0cffca7ff27b2ae5c031e4d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmV-20L}k+0V^p=O;s>9W-v4`Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U I033l4YT~68jQ{`u diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 b/test/integration/diffing2/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 deleted file mode 100644 index d4270c258e5362e874f0cd17fc6c260a82c41501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 gcmb|y2)08mZ`J^%m! diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a b/test/integration/diffing2/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a deleted file mode 100644 index 65140e8b7c0189f1a7f6fc780332ce07230ba16e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmb7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKH+(OTTc#_-_Mea=Ha+){2V^zWQe2>@J}IUIERJ#_#8 diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 b/test/integration/diffing2/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 deleted file mode 100644 index ed50454974ab7775c9d85cee55477580ac83e835..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmV-^0D=E_0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F gDKKHsW!M`KS-4_PvBb?j2CH`kU1l|{09GbA0`7u1ssI20 diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/6d/04f5ed53b383c0a4c63cac168df557b6df1e44 b/test/integration/diffing2/expected/repo/.git_keep/objects/6d/04f5ed53b383c0a4c63cac168df557b6df1e44 deleted file mode 100644 index 8728705f8ccc981927428c9a38d7429f47dc491a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0Brww0gaAJ3d0}}K)d!7?h8eo89z`;A*&o?)R6{a6M}^vzd1s;kH_Pct@mYU zo7`m_B036|Y)U0xL!``z=$NuI5?H7Tu>b@IYUe}VLmOWiJ=x?FL}3R64iXs=B->gB z&j_|O#h>xo4n58KKFv@0a^F|Em90Ot^)~ou&WgTTV~jfKIW^=@UA1KuR6kFjIUud* BKY{=N diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/7b/f3d13079ced18f5b00e29c48c777e23f687d0a b/test/integration/diffing2/expected/repo/.git_keep/objects/7b/f3d13079ced18f5b00e29c48c777e23f687d0a deleted file mode 100644 index 7404048ebcfe8c65ff94f22923e5275bccbfc504..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 118 zcmV-+0Ez#20gcT;3c@fDMq$@E#q0%{iPNM35uvLdBWeC%p&_M2@c8x!ZXX}KrPaE2 z64gsT0218cdrapK*` YZVRDeDF{Kigs}?72iZ7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKGpdh}?7z2{=TwsT3^k!H3(=W$*+1^{g9Id)YJJaPa4 diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c b/test/integration/diffing2/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c deleted file mode 100644 index 0e95eb06dda15fe1901a7942e7954b700b36bfa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmV-r0Gj`J0V^p=O;xb8WH2-^Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U zND2%YmhO4{S2gv2WLwJR>kD diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/a1/1d868e88adb55a48fc55ee1377b3255c0cd329 b/test/integration/diffing2/expected/repo/.git_keep/objects/a1/1d868e88adb55a48fc55ee1377b3255c0cd329 deleted file mode 100644 index 8d1c80d708e07529c92be949e4155ee10b77a11e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmV;F0Biqv0gcW<3d0}}K+&!}h5JI8adcv!ltNZHhK?f*#3lp_J$`e9Za;7FWovEe z7DspKhpMHL9Yn4}gp5*|oT|7H5w+47Mx+!|cG>Ld(08|7z}KK9P^L%%$qSPtL5`({ zFk~(j)q9gZ{k0u-n(cj>pZZO0U-c$idst)~I06T>R|Eia)^n=spWM`CRd0TQ%Q>$; CQ$!j7 diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/diffing2/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5fbab12262e28d85e78af8a31cd0024c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb`~^A08nuUMF0Q* diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/c6/756882cc166f52b096a5e4fb9e4f5d507870c8 b/test/integration/diffing2/expected/repo/.git_keep/objects/c6/756882cc166f52b096a5e4fb9e4f5d507870c8 deleted file mode 100644 index 3869825cb0505d3244227ee7e5edad86e9db2cda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 146 zcmV;D0B!$x0gaBq3c@fD1wH30au+1KrO5_Fgr52t$>s$MjV&dDpKm|G>o5$XTWd?V z6#3E*z($Cq;EGBSE`?LgwTzB}M-2iJ;UO!l+0%h{w~*j1R1JyS-aTn3e(oFh1& zJ@^QdKK->FcAD*dnxFWlwy(J9)*hDpnHT3rvR87>nUkJV9e?VkE-Tpl0281(oXXxs AE&u=k diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 b/test/integration/diffing2/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 deleted file mode 100644 index 2e9066287..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/objects/d0/76cc9cc09acaa2d36fbc7a95fd3e2306494641 +++ /dev/null @@ -1,2 +0,0 @@ -x+)JMU03c040031QHI5`ֶww.hT[H - yW5Ɨ(| ^-W(x9 \ No newline at end of file diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 b/test/integration/diffing2/expected/repo/.git_keep/objects/e5/c5c5583f49a34e86ce622b59363df99e09d4c6 deleted file mode 100644 index 01ce23cee261a5c479d905ee8318e897bf4bca8f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 mcmb~-q%PKJUL9GL*(lMbH% diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a b/test/integration/diffing2/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a deleted file mode 100644 index 08edf28f3f282798a9dd14ae1222a66d0c4a783a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmV-_0D%8^0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%^C{T5hys-jyt=kDGjX{j7V6OEbKX h6qqpZXf5tzV|Z}sKIfqyZYehw`ghK#1OQ99IE)E{Iurl^ diff --git a/test/integration/diffing2/expected/repo/.git_keep/objects/e8/76c3dfe2826621bea1bd3c87c2b9e2be88e69e b/test/integration/diffing2/expected/repo/.git_keep/objects/e8/76c3dfe2826621bea1bd3c87c2b9e2be88e69e deleted file mode 100644 index 7dc95dfed69e65908fda398057c1010ada704191..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0Brww0gaA93d0}}0DJZo-V0?{&8|Wzg`DyXv#vA{n-DDY`OOo09cEx;Yi;Qk zle_do)fQk9Ng|N4Bo4Txu<_EBeIltRH BNA>^! diff --git a/test/integration/diffing2/expected/repo/.git_keep/refs/heads/branch2 b/test/integration/diffing2/expected/repo/.git_keep/refs/heads/branch2 deleted file mode 100644 index da38abcfa..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/refs/heads/branch2 +++ /dev/null @@ -1 +0,0 @@ -0804f2069f5af172770da3d231be982ca320bf8b diff --git a/test/integration/diffing2/expected/repo/.git_keep/refs/heads/master b/test/integration/diffing2/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 168b462cc..000000000 --- a/test/integration/diffing2/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -06da465196938ea235323950ee451ffb36a431cf diff --git a/test/integration/diffing2/expected/repo/file0 b/test/integration/diffing2/expected/repo/file0 deleted file mode 100644 index 38143ad4a..000000000 --- a/test/integration/diffing2/expected/repo/file0 +++ /dev/null @@ -1 +0,0 @@ -test0 diff --git a/test/integration/diffing2/expected/repo/file1 b/test/integration/diffing2/expected/repo/file1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/diffing2/expected/repo/file1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/diffing2/expected/repo/file2 b/test/integration/diffing2/expected/repo/file2 deleted file mode 100644 index 180cf8328..000000000 --- a/test/integration/diffing2/expected/repo/file2 +++ /dev/null @@ -1 +0,0 @@ -test2 diff --git a/test/integration/diffing2/expected/repo/file4 b/test/integration/diffing2/expected/repo/file4 deleted file mode 100644 index 2d00bd505..000000000 --- a/test/integration/diffing2/expected/repo/file4 +++ /dev/null @@ -1 +0,0 @@ -line one diff --git a/test/integration/diffing2/recording.json b/test/integration/diffing2/recording.json deleted file mode 100644 index c560496f6..000000000 --- a/test/integration/diffing2/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":819,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1236,"Mod":0,"Key":256,"Ch":87},{"Timestamp":1491,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1899,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3115,"Mod":0,"Key":256,"Ch":87},{"Timestamp":3539,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3875,"Mod":0,"Key":258,"Ch":0},{"Timestamp":4315,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5291,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6643,"Mod":0,"Key":13,"Ch":13},{"Timestamp":7211,"Mod":0,"Key":256,"Ch":32},{"Timestamp":7475,"Mod":0,"Key":258,"Ch":0},{"Timestamp":7627,"Mod":0,"Key":256,"Ch":32},{"Timestamp":8227,"Mod":2,"Key":16,"Ch":16},{"Timestamp":8770,"Mod":0,"Key":258,"Ch":0},{"Timestamp":8963,"Mod":0,"Key":258,"Ch":0},{"Timestamp":9227,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9947,"Mod":0,"Key":260,"Ch":0},{"Timestamp":10379,"Mod":0,"Key":256,"Ch":99},{"Timestamp":10635,"Mod":0,"Key":256,"Ch":97},{"Timestamp":10674,"Mod":0,"Key":256,"Ch":115},{"Timestamp":10731,"Mod":0,"Key":256,"Ch":100},{"Timestamp":11203,"Mod":0,"Key":13,"Ch":13},{"Timestamp":11715,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/diffing2/setup.sh b/test/integration/diffing2/setup.sh deleted file mode 100644 index 4cd444a1f..000000000 --- a/test/integration/diffing2/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test0 > file0 -git add . -git commit -am file0 - -echo test1 > file1 -git add . -git commit -am file1 - -echo test2 > file2 -git add . -git commit -am file2 - -echo "line one" > file4 -git add . -git commit -am file4 - -git checkout -b branch2 - -echo "line two" >> file4 -git add . -git commit -am file4 - -echo "line three" >> file4 -git add . -git commit -am file4 - -echo "line two" >> file2 -git add . -git commit -am file2 diff --git a/test/integration/diffing2/test.json b/test/integration/diffing2/test.json deleted file mode 100644 index c72724877..000000000 --- a/test/integration/diffing2/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "diffing two branches (again) and making a patch from their diff files", "speed": 10 } diff --git a/test/integration/diffing3/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/diffing3/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index d72af3146..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -asd diff --git a/test/integration/diffing3/expected/repo/.git_keep/FETCH_HEAD b/test/integration/diffing3/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/diffing3/expected/repo/.git_keep/HEAD b/test/integration/diffing3/expected/repo/.git_keep/HEAD deleted file mode 100644 index 1d57c9ea7..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/branch2 diff --git a/test/integration/diffing3/expected/repo/.git_keep/config b/test/integration/diffing3/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/diffing3/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/diffing3/expected/repo/.git_keep/description b/test/integration/diffing3/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/diffing3/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/diffing3/expected/repo/.git_keep/index b/test/integration/diffing3/expected/repo/.git_keep/index deleted file mode 100644 index 3af23eb398326cea9c97fb163739870d45058a5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmZ?q402{*U|<4b=7j8<<_g(UV_-BR0|N`2o{%;JL*o(#2F9;IH6lRFW+7sAWx+qK zZSR5)z3*Il^U>a^rneYa(=u~X4S>=N3?TiA4Qnf5G}Ig?baR&OdHh#3^~RTo&?ugK zrwajIE!|fk<`}}vv1NWzVFok@Ohe7tjBbtu&kv&prG4jKu38jc)!*_;d%lG_#2h2A zIUzx=u0Vz)gRz1E*SwD9yeDqxURuBZDr4FEiiaJ_dvtc4SNb|nsiVVf%gPg>)(5(~ IBeRYI0E{zSIsgCw diff --git a/test/integration/diffing3/expected/repo/.git_keep/info/exclude b/test/integration/diffing3/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/diffing3/expected/repo/.git_keep/logs/HEAD b/test/integration/diffing3/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 0c3bb8fa2..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,9 +0,0 @@ -0000000000000000000000000000000000000000 13d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 CI 1617680695 +1000 commit (initial): file0 -13d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 57695899c35539821690c4c132bd0e872a01c192 CI 1617680695 +1000 commit: file1 -57695899c35539821690c4c132bd0e872a01c192 4e2d07409901af28a47f5d3b126953a5fb8b36ee CI 1617680695 +1000 commit: file2 -4e2d07409901af28a47f5d3b126953a5fb8b36ee b25b8446022fb5fcded2bab1ed2b02828a5c4d0b CI 1617680695 +1000 commit: file4 -b25b8446022fb5fcded2bab1ed2b02828a5c4d0b b25b8446022fb5fcded2bab1ed2b02828a5c4d0b CI 1617680695 +1000 checkout: moving from master to branch2 -b25b8446022fb5fcded2bab1ed2b02828a5c4d0b ffb13702e6bc59e2806bc3a5f93500e46925b131 CI 1617680695 +1000 commit: file4 -ffb13702e6bc59e2806bc3a5f93500e46925b131 275e6a821120c07a9068a9701ed14a82eeed3117 CI 1617680695 +1000 commit: file4 -275e6a821120c07a9068a9701ed14a82eeed3117 1edd26fd03ee6243bd1513788874c6c57ef1d41a CI 1617680695 +1000 commit: file2 -1edd26fd03ee6243bd1513788874c6c57ef1d41a 93b73046d6820607f1da09399b55a145d5389ab8 CI 1617680702 +1000 commit: asd diff --git a/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/branch2 b/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/branch2 deleted file mode 100644 index 388d6e906..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/branch2 +++ /dev/null @@ -1,5 +0,0 @@ -0000000000000000000000000000000000000000 b25b8446022fb5fcded2bab1ed2b02828a5c4d0b CI 1617680695 +1000 branch: Created from HEAD -b25b8446022fb5fcded2bab1ed2b02828a5c4d0b ffb13702e6bc59e2806bc3a5f93500e46925b131 CI 1617680695 +1000 commit: file4 -ffb13702e6bc59e2806bc3a5f93500e46925b131 275e6a821120c07a9068a9701ed14a82eeed3117 CI 1617680695 +1000 commit: file4 -275e6a821120c07a9068a9701ed14a82eeed3117 1edd26fd03ee6243bd1513788874c6c57ef1d41a CI 1617680695 +1000 commit: file2 -1edd26fd03ee6243bd1513788874c6c57ef1d41a 93b73046d6820607f1da09399b55a145d5389ab8 CI 1617680702 +1000 commit: asd diff --git a/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 2eee36176..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 13d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 CI 1617680695 +1000 commit (initial): file0 -13d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 57695899c35539821690c4c132bd0e872a01c192 CI 1617680695 +1000 commit: file1 -57695899c35539821690c4c132bd0e872a01c192 4e2d07409901af28a47f5d3b126953a5fb8b36ee CI 1617680695 +1000 commit: file2 -4e2d07409901af28a47f5d3b126953a5fb8b36ee b25b8446022fb5fcded2bab1ed2b02828a5c4d0b CI 1617680695 +1000 commit: file4 diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 b/test/integration/diffing3/expected/repo/.git_keep/objects/0c/2aa38e0600e0d2df09c2f84664d8a14f899879 deleted file mode 100644 index 38acaeff2c4712a28ba59b99a0ddd33f70433acf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36 ucmV+<0Nej~0ZYosPf{?lWXQ?POI66vOXUJHO3L%0jEthxR4xGKxeQfIM-lJ< diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/13/d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 b/test/integration/diffing3/expected/repo/.git_keep/objects/13/d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 deleted file mode 100644 index 0b6ffa3fc..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/objects/13/d8ce6d541ffd4b323376e2530ccdd3bcc7b8d5 +++ /dev/null @@ -1,2 +0,0 @@ -xA -0@Q9IDz`!Dn?j];f@v7 IUs!Hdc*\Ч\+wi4mi $dD۟ܕu3t?+ \ No newline at end of file diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/diffing3/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 deleted file mode 100644 index f74bf2335bbc5999ad0faff94fb04165d8ab5c7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb~ZE#08nZNMgRZ+ diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 b/test/integration/diffing3/expected/repo/.git_keep/objects/1e/3e67b999db1576ad1ee08bf4f02bdf29e49442 deleted file mode 100644 index 79fcadf67fdecb0f0cffca7ff27b2ae5c031e4d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmV-20L}k+0V^p=O;s>9W-v4`Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U I033l4YT~68jQ{`u diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/1e/dd26fd03ee6243bd1513788874c6c57ef1d41a b/test/integration/diffing3/expected/repo/.git_keep/objects/1e/dd26fd03ee6243bd1513788874c6c57ef1d41a deleted file mode 100644 index d27019b84..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/objects/1e/dd26fd03ee6243bd1513788874c6c57ef1d41a +++ /dev/null @@ -1,2 +0,0 @@ -xA -@ Fas 6#Nb~+L5rS݁3mEHJJ:"ћ5XN gx(B= P!L<1n0\-=v}u__.ʦ4D=*8͐?b9 \ No newline at end of file diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/27/5e6a821120c07a9068a9701ed14a82eeed3117 b/test/integration/diffing3/expected/repo/.git_keep/objects/27/5e6a821120c07a9068a9701ed14a82eeed3117 deleted file mode 100644 index 4ce25a568..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/objects/27/5e6a821120c07a9068a9701ed14a82eeed3117 +++ /dev/null @@ -1,2 +0,0 @@ -xA -0E]dfҤ("tc$qƖ#{|އZ$|i*gb -f"b bdxA)숬>e';Xv ?0/0C^@FߏJhڣn:38 \ No newline at end of file diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 b/test/integration/diffing3/expected/repo/.git_keep/objects/2d/00bd505971a8bc7318d98e003aee708a367c85 deleted file mode 100644 index d4270c258e5362e874f0cd17fc6c260a82c41501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 gcmb|y2)08mZ`J^%m! diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a b/test/integration/diffing3/expected/repo/.git_keep/objects/3b/aaa732b89ed46a1af1b24d0d4e3b8c7375684a deleted file mode 100644 index 65140e8b7c0189f1a7f6fc780332ce07230ba16e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmb7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKH+(OTTc#_-_Mea=Ha+){2V^zWQe2>@J}IUIERJ#_#8 diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/4e/2d07409901af28a47f5d3b126953a5fb8b36ee b/test/integration/diffing3/expected/repo/.git_keep/objects/4e/2d07409901af28a47f5d3b126953a5fb8b36ee deleted file mode 100644 index 49d0ec6d7..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/objects/4e/2d07409901af28a47f5d3b126953a5fb8b36ee +++ /dev/null @@ -1,3 +0,0 @@ -xA -0a9ELL2#L`l)<9Ǔ[LtꇪMʜ#T -cY"$fχ1$)%& *h))Mvii~7b<ÀugnR2?/8 \ No newline at end of file diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/57/695899c35539821690c4c132bd0e872a01c192 b/test/integration/diffing3/expected/repo/.git_keep/objects/57/695899c35539821690c4c132bd0e872a01c192 deleted file mode 100644 index 6fe16bc3d2f7ae43d8961deac5bb49dbe39367ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0Brww0gaA93d0}}0DJZo-V0@Qb&XI;A*Vb;cUKxnnh-4X`OOo09cEy7Ti3Z; zm;I$5s#YKob7qEIxD+o)t#T?kHbM0W6mp>8%w7(CpCQV?N)m%>O+rPFm`Hs@U>3p3 zoa!Laluv(chaD$-AE&2&%epUm<86IdM=sF-l%u^m05B&#r@H>Bn>H`%%n#>4I!=Q& BKMVi> diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 b/test/integration/diffing3/expected/repo/.git_keep/objects/59/a0ec98e1847ca72dc35b7ab8b84f527b6af280 deleted file mode 100644 index ed50454974ab7775c9d85cee55477580ac83e835..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmV-^0D=E_0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F gDKKHsW!M`KS-4_PvBb?j2CH`kU1l|{09GbA0`7u1ssI20 diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 b/test/integration/diffing3/expected/repo/.git_keep/objects/8e/4cb0cd56d785ba4442a5b20e7ae5de5ae33723 deleted file mode 100644 index 2920ab335181ed440a54f52297d3cb1ab3a70222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmV-_0D%8^0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%@oj{4i=z+IQ~dszu>d{VlJw=Ub>F hDKKGpdh}?7z2{=TwsT3^k!H3(=W$*+1^{g9Id)YJJaPa4 diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/93/b73046d6820607f1da09399b55a145d5389ab8 b/test/integration/diffing3/expected/repo/.git_keep/objects/93/b73046d6820607f1da09399b55a145d5389ab8 deleted file mode 100644 index 1dbb386fcbb4df3f4721439970d2fe36328e3b0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 146 zcmV;D0B!$x0gaA93c@fDMP26<*$Xn0w3!h^gsyswX=Z|gv86`v_~r<1AMbsBUTb|c zk7qcv-OQhjSqL<LQc;LzDGYH@95E6z(~wgh z$qMR#;^for>+Yx7U#9tHU#Z*EPI;|YkEzcy5Cnfj0C1i5Q_cR=oxIik09XAvS?2FW A*Z=?k diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c b/test/integration/diffing3/expected/repo/.git_keep/objects/9e/88a70dc8d82dd2afbfd50176ef78e18823bc2c deleted file mode 100644 index 0e95eb06dda15fe1901a7942e7954b700b36bfa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmV-r0Gj`J0V^p=O;xb8WH2-^Ff%bxNXyJgHDIt1vAVM0pVqc_!H3>=F1`6^?^M%U zND2%YmhO4{S2gv2WLwJR>kD diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/diffing3/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5fbab12262e28d85e78af8a31cd0024c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb`~^A08nuUMF0Q* diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/b2/5b8446022fb5fcded2bab1ed2b02828a5c4d0b b/test/integration/diffing3/expected/repo/.git_keep/objects/b2/5b8446022fb5fcded2bab1ed2b02828a5c4d0b deleted file mode 100644 index 7840a7939203b9017ef5ab786d9abbe463e55804..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmV;F0Biqv0gaAL3c@fDMqTF=*$Xn0zezwu=&Hw z#$-XhQOq zeI20v!>^5M2W~-q%PKJUL9GL*(lMbH% diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a b/test/integration/diffing3/expected/repo/.git_keep/objects/e7/76522ac28860d2eba6fe98fa4fad67e798419a deleted file mode 100644 index 08edf28f3f282798a9dd14ae1222a66d0c4a783a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmV-_0D%8^0V^p=O;s>7HexU|FfcPQQAo?oNi|@w5V5+l;GfpEcfp6=cP_p8Xzx_h zTSy8F8J6yO{8u&g#+QiDD4u+$3jtm&-B*zm7%^C{T5hys-jyt=kDGjX{j7V6OEbKX h6qqpZXf5tzV|Z}sKIfqyZYehw`ghK#1OQ99IE)E{Iurl^ diff --git a/test/integration/diffing3/expected/repo/.git_keep/objects/ff/b13702e6bc59e2806bc3a5f93500e46925b131 b/test/integration/diffing3/expected/repo/.git_keep/objects/ff/b13702e6bc59e2806bc3a5f93500e46925b131 deleted file mode 100644 index 41ee689edc7511ff392b6defa859879a72f56bff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0Brww0gaA93c@fD06pgwxeKz{?j{jLgr540-DHb})|L{%=Uac^X<(SclyzCA z=ED_FZ8!7Ts3?@mv8K!_M1;bMU`dRtu~^q7?A#{1y_#2K%|sCpN9D0ptEi&k2f&P3 zxKIUk@@~&{_x<2+{qV4lEZc0CvMzTYVn{JVys|$B0C0yrrkeekyK$P0+!yBJI%9s& BOa%Y{ diff --git a/test/integration/diffing3/expected/repo/.git_keep/refs/heads/branch2 b/test/integration/diffing3/expected/repo/.git_keep/refs/heads/branch2 deleted file mode 100644 index 0fd67f431..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/refs/heads/branch2 +++ /dev/null @@ -1 +0,0 @@ -93b73046d6820607f1da09399b55a145d5389ab8 diff --git a/test/integration/diffing3/expected/repo/.git_keep/refs/heads/master b/test/integration/diffing3/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 1ae5bbe93..000000000 --- a/test/integration/diffing3/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -b25b8446022fb5fcded2bab1ed2b02828a5c4d0b diff --git a/test/integration/diffing3/expected/repo/file0 b/test/integration/diffing3/expected/repo/file0 deleted file mode 100644 index 38143ad4a..000000000 --- a/test/integration/diffing3/expected/repo/file0 +++ /dev/null @@ -1 +0,0 @@ -test0 diff --git a/test/integration/diffing3/expected/repo/file1 b/test/integration/diffing3/expected/repo/file1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/diffing3/expected/repo/file1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/diffing3/expected/repo/file2 b/test/integration/diffing3/expected/repo/file2 deleted file mode 100644 index 180cf8328..000000000 --- a/test/integration/diffing3/expected/repo/file2 +++ /dev/null @@ -1 +0,0 @@ -test2 diff --git a/test/integration/diffing3/recording.json b/test/integration/diffing3/recording.json deleted file mode 100644 index 3075a9b2f..000000000 --- a/test/integration/diffing3/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":487,"Mod":0,"Key":259,"Ch":0},{"Timestamp":768,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1039,"Mod":0,"Key":256,"Ch":87},{"Timestamp":1303,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1599,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1791,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1975,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2151,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2384,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3335,"Mod":0,"Key":256,"Ch":32},{"Timestamp":3527,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3679,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4214,"Mod":2,"Key":16,"Ch":16},{"Timestamp":5111,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5327,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6006,"Mod":0,"Key":260,"Ch":0},{"Timestamp":6223,"Mod":0,"Key":260,"Ch":0},{"Timestamp":6447,"Mod":0,"Key":256,"Ch":99},{"Timestamp":6631,"Mod":0,"Key":256,"Ch":97},{"Timestamp":6671,"Mod":0,"Key":256,"Ch":115},{"Timestamp":6743,"Mod":0,"Key":256,"Ch":100},{"Timestamp":7111,"Mod":0,"Key":13,"Ch":13},{"Timestamp":7559,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/diffing3/setup.sh b/test/integration/diffing3/setup.sh deleted file mode 100644 index 4cd444a1f..000000000 --- a/test/integration/diffing3/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test0 > file0 -git add . -git commit -am file0 - -echo test1 > file1 -git add . -git commit -am file1 - -echo test2 > file2 -git add . -git commit -am file2 - -echo "line one" > file4 -git add . -git commit -am file4 - -git checkout -b branch2 - -echo "line two" >> file4 -git add . -git commit -am file4 - -echo "line three" >> file4 -git add . -git commit -am file4 - -echo "line two" >> file2 -git add . -git commit -am file2 diff --git a/test/integration/diffing3/test.json b/test/integration/diffing3/test.json deleted file mode 100644 index 8e427d1f4..000000000 --- a/test/integration/diffing3/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "diffing two commits and making a patch from their diff files", "speed": 10 } From 5c11b1ecb7cd5da23969c63569d40849ffd4e3d1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 16:46:01 +1100 Subject: [PATCH 3/9] discard changes integration test --- pkg/gui/gui_driver.go | 4 +- pkg/integration/components/shell.go | 26 ++++ pkg/integration/tests/file/discard_changes.go | 123 ++++++++++++++++++ pkg/integration/tests/tests.go | 1 + .../expected/repo/.git_keep/COMMIT_EDITMSG | 23 ---- .../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 1524 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 7 - .../expected/repo/.git_keep/logs/HEAD | 8 -- .../repo/.git_keep/logs/refs/heads/conflict | 3 - .../.git_keep/logs/refs/heads/conflict_second | 4 - .../11/bdfc142c42c6ffaa904890ab61ec76262ec9ca | 2 - .../15/fe7f43604da957ffb663b4db95b60d0af66469 | Bin 48 -> 0 bytes .../1c/9488b0e1b8abd1ec8645b3345bdac91290b464 | Bin 350 -> 0 bytes .../26/80cfddbd9fa03c059ac60d2bec5e59a1c34281 | Bin 19 -> 0 bytes .../2c/e75e2a24f7d6841a504cf3616ef5a59edb3a2d | Bin 27 -> 0 bytes .../30/07c9c07bf80aaa72b1f1f704e7fea622446678 | Bin 342 -> 0 bytes .../3f/7bd8f68987d4e16b8f6fa7f6b0738b42180d1f | Bin 30 -> 0 bytes .../47/966dcaa8ee736e89279b895faf8707de898e04 | Bin 30 -> 0 bytes .../48/f9387742d3cc3017c1a7e292c9187e35321753 | Bin 31 -> 0 bytes .../4d/8452fc76beed0c7b15e40e45d06922bf746c5f | Bin 20 -> 0 bytes .../59/cf7b78af9aab84813bcb0bc8be27fdd9216b2b | Bin 351 -> 0 bytes .../5a/d28e22767f979da2c198dc6c1003b25964e3da | Bin 20 -> 0 bytes .../5b/e4a414b32cf4204f889469942986d3d783da84 | Bin 23 -> 0 bytes .../7a/22af9d1908d85e3c4b6d916a9b6c733c55c990 | Bin 30 -> 0 bytes .../85/4f08fa802293e0679d07771547fe9fe5d159e8 | Bin 201 -> 0 bytes .../89/44a13fdfc597e4cf1d23797df51977680f8e77 | Bin 21 -> 0 bytes .../8c/82faa1358ce6cddba19d59b2924cbcc5ef1c8e | Bin 147 -> 0 bytes .../90/7b308167f0880fb2a5c0e1614bb0c7620f9dc3 | Bin 20 -> 0 bytes .../90/be1f3056c4f471f977a28497b8d4b392c55a02 | Bin 22 -> 0 bytes .../98/e834e9cdae1191de7fafb2b6f334bddd0793e8 | Bin 116 -> 0 bytes .../99/76d7948def8b082e9d20135d6a04624d711752 | 1 - .../9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 | Bin 20 -> 0 bytes .../9f/5118ee216a6e44728305f90633b0c0e2ad235c | Bin 21 -> 0 bytes .../a1/be04124078e38a592c153942bf75edf210f1ed | Bin 48 -> 0 bytes .../a1/e09c2fda67b9f8d4440073c0c33f6e45689b7c | Bin 30 -> 0 bytes .../ab/addc0b9edd523c69166a2c9f3a9e31a4c873e3 | Bin 19 -> 0 bytes .../c9/1b3b139ea108475c19839fcda3a4e33db4ccc9 | 2 - .../ce/e08babc6b109f011f42eaba5f79e6e693c09e7 | Bin 349 -> 0 bytes .../d4/d1b67951582a751c12ff7ea29ede7d37fd9ee8 | Bin 27 -> 0 bytes .../d7/98b86744c3997c186e0f0dc666f02943c797a7 | Bin 22 -> 0 bytes .../e9/55de60e73263440d4651e79e947ec8b2902373 | Bin 351 -> 0 bytes .../fa/938d99f6ee5cc562cd0f33fa64fd68d78ce2e9 | Bin 20 -> 0 bytes .../repo/.git_keep/refs/heads/conflict | 1 - .../repo/.git_keep/refs/heads/conflict_second | 1 - .../expected/repo/both-added.txt | 1 - .../expected/repo/both-modded.txt | 1 - .../expected/repo/change-delete.txt | 1 - .../expected/repo/changed-them-added-us.txt | 1 - .../expected/repo/delete-change.txt | 1 - .../expected/repo/deleted-staged.txt | 1 - .../expected/repo/deleted-them.txt | 1 - .../expected/repo/deleted.txt | 1 - .../expected/repo/double-modded.txt | 1 - .../expected/repo/modded-staged.txt | 1 - .../expected/repo/modded.txt | 1 - .../expected/repo/renamed.txt | 1 - .../discardFileChanges/recording.json | 1 - test/integration/discardFileChanges/setup.sh | 65 --------- test/integration/discardFileChanges/test.json | 1 - 64 files changed, 153 insertions(+), 145 deletions(-) create mode 100644 pkg/integration/tests/file/discard_changes.go delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/ORIG_HEAD delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/config delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/description delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/index delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict_second delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/11/bdfc142c42c6ffaa904890ab61ec76262ec9ca delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/15/fe7f43604da957ffb663b4db95b60d0af66469 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/1c/9488b0e1b8abd1ec8645b3345bdac91290b464 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/26/80cfddbd9fa03c059ac60d2bec5e59a1c34281 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/2c/e75e2a24f7d6841a504cf3616ef5a59edb3a2d delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/30/07c9c07bf80aaa72b1f1f704e7fea622446678 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/3f/7bd8f68987d4e16b8f6fa7f6b0738b42180d1f delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/47/966dcaa8ee736e89279b895faf8707de898e04 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/48/f9387742d3cc3017c1a7e292c9187e35321753 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/4d/8452fc76beed0c7b15e40e45d06922bf746c5f delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/59/cf7b78af9aab84813bcb0bc8be27fdd9216b2b delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/5a/d28e22767f979da2c198dc6c1003b25964e3da delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/5b/e4a414b32cf4204f889469942986d3d783da84 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/7a/22af9d1908d85e3c4b6d916a9b6c733c55c990 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/85/4f08fa802293e0679d07771547fe9fe5d159e8 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/89/44a13fdfc597e4cf1d23797df51977680f8e77 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/8c/82faa1358ce6cddba19d59b2924cbcc5ef1c8e delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/90/7b308167f0880fb2a5c0e1614bb0c7620f9dc3 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/90/be1f3056c4f471f977a28497b8d4b392c55a02 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/98/e834e9cdae1191de7fafb2b6f334bddd0793e8 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/99/76d7948def8b082e9d20135d6a04624d711752 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/9f/5118ee216a6e44728305f90633b0c0e2ad235c delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/a1/be04124078e38a592c153942bf75edf210f1ed delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/a1/e09c2fda67b9f8d4440073c0c33f6e45689b7c delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/ab/addc0b9edd523c69166a2c9f3a9e31a4c873e3 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/c9/1b3b139ea108475c19839fcda3a4e33db4ccc9 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/ce/e08babc6b109f011f42eaba5f79e6e693c09e7 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/d4/d1b67951582a751c12ff7ea29ede7d37fd9ee8 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/d7/98b86744c3997c186e0f0dc666f02943c797a7 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/e9/55de60e73263440d4651e79e947ec8b2902373 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/objects/fa/938d99f6ee5cc562cd0f33fa64fd68d78ce2e9 delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/refs/heads/conflict delete mode 100644 test/integration/discardFileChanges/expected/repo/.git_keep/refs/heads/conflict_second delete mode 100644 test/integration/discardFileChanges/expected/repo/both-added.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/both-modded.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/change-delete.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/changed-them-added-us.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/delete-change.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/deleted-staged.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/deleted-them.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/deleted.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/double-modded.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/modded-staged.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/modded.txt delete mode 100644 test/integration/discardFileChanges/expected/repo/renamed.txt delete mode 100644 test/integration/discardFileChanges/recording.json delete mode 100644 test/integration/discardFileChanges/setup.sh delete mode 100644 test/integration/discardFileChanges/test.json diff --git a/pkg/gui/gui_driver.go b/pkg/gui/gui_driver.go index 919ad5416..268d53f1d 100644 --- a/pkg/gui/gui_driver.go +++ b/pkg/gui/gui_driver.go @@ -1,6 +1,8 @@ package gui import ( + "fmt" + "strings" "time" "github.com/gdamore/tcell/v2" @@ -55,7 +57,7 @@ func (self *GuiDriver) Fail(message string) { self.gui.g.Close() // need to give the gui time to close time.Sleep(time.Millisecond * 100) - panic(message) + panic(fmt.Sprintf("%s\nLog:\n%s", message, strings.Join(self.gui.CmdLog, "\n"))) } // logs to the normal place that you log to i.e. viewable with `lazygit --logs` diff --git a/pkg/integration/components/shell.go b/pkg/integration/components/shell.go index 409a17bc6..d0f0345dc 100644 --- a/pkg/integration/components/shell.go +++ b/pkg/integration/components/shell.go @@ -35,6 +35,32 @@ func (s *Shell) RunCommand(cmdStr string) *Shell { return s } +func (s *Shell) RunShellCommand(cmdStr string) *Shell { + cmd := secureexec.Command("sh", "-c", cmdStr) + cmd.Env = os.Environ() + cmd.Dir = s.dir + + output, err := cmd.CombinedOutput() + if err != nil { + panic(fmt.Sprintf("error running shell command: %s\n%s", cmdStr, string(output))) + } + + return s +} + +func (s *Shell) RunShellCommandExpectError(cmdStr string) *Shell { + cmd := secureexec.Command("sh", "-c", cmdStr) + cmd.Env = os.Environ() + cmd.Dir = s.dir + + output, err := cmd.CombinedOutput() + if err == nil { + panic(fmt.Sprintf("Expected error running shell command: %s\n%s", cmdStr, string(output))) + } + + return s +} + func (s *Shell) CreateFile(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/discard_changes.go b/pkg/integration/tests/file/discard_changes.go new file mode 100644 index 000000000..ce2e2c65d --- /dev/null +++ b/pkg/integration/tests/file/discard_changes.go @@ -0,0 +1,123 @@ +package file + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Discarding all possible permutations of changed files", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) { + }, + SetupRepo: func(shell *Shell) { + // typically we would use more bespoke shell methods here, but I struggled to find a way to do that, + // and this is copied over from a legacy integration test which did everything in a big shell script + // so I'm just copying it across. + + // common stuff + shell.RunShellCommand(`echo test > both-deleted.txt`) + shell.RunShellCommand(`git checkout -b conflict && git add both-deleted.txt`) + shell.RunShellCommand(`echo bothmodded > both-modded.txt && git add both-modded.txt`) + shell.RunShellCommand(`echo haha > deleted-them.txt && git add deleted-them.txt`) + shell.RunShellCommand(`echo haha2 > deleted-us.txt && git add deleted-us.txt`) + shell.RunShellCommand(`echo mod > modded.txt & git add modded.txt`) + shell.RunShellCommand(`echo mod > modded-staged.txt & git add modded-staged.txt`) + shell.RunShellCommand(`echo del > deleted.txt && git add deleted.txt`) + shell.RunShellCommand(`echo del > deleted-staged.txt && git add deleted-staged.txt`) + shell.RunShellCommand(`echo change-delete > change-delete.txt && git add change-delete.txt`) + shell.RunShellCommand(`echo delete-change > delete-change.txt && git add delete-change.txt`) + shell.RunShellCommand(`echo double-modded > double-modded.txt && git add double-modded.txt`) + shell.RunShellCommand(`echo "renamed\nhaha" > renamed.txt && git add renamed.txt`) + shell.RunShellCommand(`git commit -m one`) + + // stuff on other branch + shell.RunShellCommand(`git branch conflict_second && git mv both-deleted.txt added-them-changed-us.txt`) + shell.RunShellCommand(`git commit -m "both-deleted.txt renamed in added-them-changed-us.txt"`) + shell.RunShellCommand(`echo blah > both-added.txt && git add both-added.txt`) + shell.RunShellCommand(`echo mod1 > both-modded.txt && git add both-modded.txt`) + shell.RunShellCommand(`rm deleted-them.txt && git add deleted-them.txt`) + shell.RunShellCommand(`echo modded > deleted-us.txt && git add deleted-us.txt`) + shell.RunShellCommand(`git commit -m "two"`) + + // stuff on our branch + shell.RunShellCommand(`git checkout conflict_second`) + shell.RunShellCommand(`git mv both-deleted.txt changed-them-added-us.txt`) + shell.RunShellCommand(`git commit -m "both-deleted.txt renamed in changed-them-added-us.txt"`) + shell.RunShellCommand(`echo mod2 > both-modded.txt && git add both-modded.txt`) + shell.RunShellCommand(`echo blah2 > both-added.txt && git add both-added.txt`) + shell.RunShellCommand(`echo modded > deleted-them.txt && git add deleted-them.txt`) + shell.RunShellCommand(`rm deleted-us.txt && git add deleted-us.txt`) + shell.RunShellCommand(`git commit -m "three"`) + shell.RunShellCommand(`git reset --hard conflict_second`) + shell.RunShellCommandExpectError(`git merge conflict`) + + shell.RunShellCommand(`echo "new" > new.txt`) + shell.RunShellCommand(`echo "new staged" > new-staged.txt && git add new-staged.txt`) + shell.RunShellCommand(`echo mod2 > modded.txt`) + shell.RunShellCommand(`echo mod2 > modded-staged.txt && git add modded-staged.txt`) + shell.RunShellCommand(`rm deleted.txt`) + shell.RunShellCommand(`rm deleted-staged.txt && git add deleted-staged.txt`) + shell.RunShellCommand(`echo change-delete2 > change-delete.txt && git add change-delete.txt`) + shell.RunShellCommand(`rm change-delete.txt`) + shell.RunShellCommand(`rm delete-change.txt && git add delete-change.txt`) + shell.RunShellCommand(`echo "changed" > delete-change.txt`) + shell.RunShellCommand(`echo "change1" > double-modded.txt && git add double-modded.txt`) + shell.RunShellCommand(`echo "change2" > double-modded.txt`) + shell.RunShellCommand(`echo before > added-changed.txt && git add added-changed.txt`) + shell.RunShellCommand(`echo after > added-changed.txt`) + shell.RunShellCommand(`rm renamed.txt && git add renamed.txt`) + shell.RunShellCommand(`echo "renamed\nhaha" > renamed2.txt && git add renamed2.txt`) + }, + + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + assert.CommitCount(3) + + type statusFile struct { + status string + path string + } + + discardOneByOne := func(files []statusFile) { + for _, file := range files { + assert.MatchSelectedLine(Contains(file.status + " " + file.path)) + input.PressKeys(keys.Universal.Remove) + assert.InMenu() + assert.MatchCurrentViewContent(Contains("discard all changes")) + input.Confirm() + } + } + + discardOneByOne([]statusFile{ + {"UA", "added-them-changed-us.txt"}, + {"AA", "both-added.txt"}, + {"DD", "both-deleted.txt"}, + {"UU", "both-modded.txt"}, + {"AU", "changed-them-added-us.txt"}, + {"UD", "deleted-them.txt"}, + {"DU", "deleted-us.txt"}, + }) + + assert.InConfirm() + assert.MatchCurrentViewTitle(Contains("continue")) + assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + input.PressKeys(keys.Universal.Return) + + discardOneByOne([]statusFile{ + {"MD", "change-delete.txt"}, + {"D ", "delete-change.txt"}, + {"D ", "deleted-staged.txt"}, + {" D", "deleted.txt"}, + {"MM", "double-modded.txt"}, + {"M ", "modded-staged.txt"}, + {" M", "modded.txt"}, + {"R ", "renamed.txt → renamed2.txt"}, + {"AM", "added-changed.txt"}, + {"A ", "new-staged.txt"}, + {"??", "new.txt"}, + }) + + assert.WorkingTreeFileCount(0) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 53961363e..6f7476657 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -52,6 +52,7 @@ var tests = []*components.IntegrationTest{ custom_commands.MenuFromCommandsOutput, custom_commands.MultiplePrompts, file.DirWithUntrackedFile, + file.DiscardChanges, interactive_rebase.AmendMerge, interactive_rebase.One, stash.Rename, diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/discardFileChanges/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 552587d35..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1,23 +0,0 @@ -Merge branch 'conflict' into conflict_second - -# Conflicts: -# added-them-changed-us.txt -# both-added.txt -# both-deleted.txt -# both-modded.txt -# changed-them-added-us.txt -# deleted-them.txt -# deleted-us.txt -# -# It looks like you may be committing a merge. -# If this is not correct, please remove the file -# /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/discardFileChanges/actual/.git/MERGE_HEAD -# and try again. - - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# On branch conflict_second -# All conflicts fixed but you are still merging. -# diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/FETCH_HEAD b/test/integration/discardFileChanges/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/HEAD b/test/integration/discardFileChanges/expected/repo/.git_keep/HEAD deleted file mode 100644 index 52c2dc641..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/conflict_second diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/ORIG_HEAD b/test/integration/discardFileChanges/expected/repo/.git_keep/ORIG_HEAD deleted file mode 100644 index e45dbd932..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/ORIG_HEAD +++ /dev/null @@ -1 +0,0 @@ -11bdfc142c42c6ffaa904890ab61ec76262ec9ca diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/config b/test/integration/discardFileChanges/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/discardFileChanges/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/discardFileChanges/expected/repo/.git_keep/description b/test/integration/discardFileChanges/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/discardFileChanges/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/discardFileChanges/expected/repo/.git_keep/index b/test/integration/discardFileChanges/expected/repo/.git_keep/index deleted file mode 100644 index 3021c8c326aef0202345328e3eaf54fee931dcef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1524 zcmZ?q402{*U|<4bo`mczn|bA0N?#O-xBiP0=flH0dnA@voG>8P|Iry=34Ao0pr9WFXL-T_PNPFJLs(JQFnY_}r)Eo?7v)IImNE zc4z$hcJ_OneJl)u$r*`x>8ZLYsX3`7sbD7p&DkLKx^x|khM32B2+cg!x$D;NZ1eeI z5V~&iz76ZI9lz+Ze+h#m#Jm*Ul8n?`h`)79i(%&O=HJ;Y4m1}`L)~ePW-i~t2Xpjq zrSJT4#f72xz+wA5*NoXU41y2`>Ozc%nYV}cQLR1DJTMJ4&j!srmep(TaL>CNWRoeD zr8D1Zp5c-c#g7?;Am*j$7MCQZBjN@cKO01hPFw)_A4Eg_KMBoT_Ukitq`MrRStF6h z&wDKGgQoNG>B|`eVCI7S4~cQ0IeWRpQr5s|s5>3d%){qd?9BrJsH5>c2qg z5llnP1EyD$^vGvledAka`;~{;{rStkZ7A+`lHipGhGTwdQckKaQVIf^v!BKFl>>~1 zn&*aQ9*bJT`MZ1PFR)>qb&Oa0O!gr1zhz+IG@mzawZ!68Ae zu0W%u7z~XR47eiCS68f`wYsIz`ZV{6ed>R2DrRd3xrPEmlkpZf+d@(@ELlU-vH^nu zgQ0EUXjTCkNA6RHgw(?4|ZZ(4fbVWRhj<4OE;4}* 1617671344 +1000 commit (initial): one -98e834e9cdae1191de7fafb2b6f334bddd0793e8 9976d7948def8b082e9d20135d6a04624d711752 CI 1617671344 +1000 commit: both-deleted.txt renamed in added-them-changed-us.txt -9976d7948def8b082e9d20135d6a04624d711752 8c82faa1358ce6cddba19d59b2924cbcc5ef1c8e CI 1617671344 +1000 commit: two -8c82faa1358ce6cddba19d59b2924cbcc5ef1c8e 98e834e9cdae1191de7fafb2b6f334bddd0793e8 CI 1617671344 +1000 checkout: moving from conflict to conflict_second -98e834e9cdae1191de7fafb2b6f334bddd0793e8 c91b3b139ea108475c19839fcda3a4e33db4ccc9 CI 1617671344 +1000 commit: both-deleted.txt renamed in changed-them-added-us.txt -c91b3b139ea108475c19839fcda3a4e33db4ccc9 11bdfc142c42c6ffaa904890ab61ec76262ec9ca CI 1617671344 +1000 commit: three -11bdfc142c42c6ffaa904890ab61ec76262ec9ca 11bdfc142c42c6ffaa904890ab61ec76262ec9ca CI 1617671344 +1000 reset: moving to conflict_second -11bdfc142c42c6ffaa904890ab61ec76262ec9ca 854f08fa802293e0679d07771547fe9fe5d159e8 CI 1617671365 +1000 commit (merge): Merge branch 'conflict' into conflict_second diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict b/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict deleted file mode 100644 index ba5017ea9..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict +++ /dev/null @@ -1,3 +0,0 @@ -0000000000000000000000000000000000000000 98e834e9cdae1191de7fafb2b6f334bddd0793e8 CI 1617671344 +1000 commit (initial): one -98e834e9cdae1191de7fafb2b6f334bddd0793e8 9976d7948def8b082e9d20135d6a04624d711752 CI 1617671344 +1000 commit: both-deleted.txt renamed in added-them-changed-us.txt -9976d7948def8b082e9d20135d6a04624d711752 8c82faa1358ce6cddba19d59b2924cbcc5ef1c8e CI 1617671344 +1000 commit: two diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict_second b/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict_second deleted file mode 100644 index d7cdb2c6e..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/logs/refs/heads/conflict_second +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 98e834e9cdae1191de7fafb2b6f334bddd0793e8 CI 1617671344 +1000 branch: Created from conflict -98e834e9cdae1191de7fafb2b6f334bddd0793e8 c91b3b139ea108475c19839fcda3a4e33db4ccc9 CI 1617671344 +1000 commit: both-deleted.txt renamed in changed-them-added-us.txt -c91b3b139ea108475c19839fcda3a4e33db4ccc9 11bdfc142c42c6ffaa904890ab61ec76262ec9ca CI 1617671344 +1000 commit: three -11bdfc142c42c6ffaa904890ab61ec76262ec9ca 854f08fa802293e0679d07771547fe9fe5d159e8 CI 1617671365 +1000 commit (merge): Merge branch 'conflict' into conflict_second diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/11/bdfc142c42c6ffaa904890ab61ec76262ec9ca b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/11/bdfc142c42c6ffaa904890ab61ec76262ec9ca deleted file mode 100644 index 28cbe4c0d..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/11/bdfc142c42c6ffaa904890ab61ec76262ec9ca +++ /dev/null @@ -1,2 +0,0 @@ -xA -0@Q9Ed:icf2AR"x|{xh8̏5I\Yr̀Dؐj)4$w{wHrLe!J?~^u^嶽ky M 0F;㠻!z: \ No newline at end of file diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/15/fe7f43604da957ffb663b4db95b60d0af66469 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/15/fe7f43604da957ffb663b4db95b60d0af66469 deleted file mode 100644 index cd888e56cf518570ce7c6a622c49a5f1027a4dc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48 zcmb8GGZ_^FfcPQQAkWlNlno$$wN*Ly@ zTfei-=Zit;y2<-CtiN{rqRajzP)$ksB^kP4onVy{stp>`KXmYKT6*ANqW6a5N&IsU zBdg5K2U!AE>e~|Zr)=L_o@&u2e6ANVmG+n9#6y)rtk+FR%}Fgu1uJ%+mV0W&yW+e~ z_1T^A>)YAyb@s796+=`(oeWmI@WCAYTj@K0TybG2K5*DR&oyIq4T|Cv-Qto&p#Q+C zSFgRpJ@0OiO{Q3u&U~wRhD%NqKSomx4TkG8cBH!;o>?Q2$Ip8#?SrQC@#)J^RT4BX zzceW)RTn7~?5l5l>ukUBFuOm0`L_+l-A)p`@=!A&s*s(k)^Psr-uVk`SZ5vM)qWEf wx$v-4BZ^|M{diOrrRF8(Lj7H(w0^E6$Bj4}@7#%5vvZ1VLQhTr0F@8Z^N4t_DgXcg diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/26/80cfddbd9fa03c059ac60d2bec5e59a1c34281 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/26/80cfddbd9fa03c059ac60d2bec5e59a1c34281 deleted file mode 100644 index 0931fd1bd3ae67a11709c6569502cab617db4545..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19 acmb8G-WU}FfcPQQAo-!$n88pu>RWdi!S?@Agj&IPf39)y>f9|WnhF>sf^J7x<&Ku)tdjE_X4UkIU_MIJr!y& z*j)E%xu;gVE6(dwpWPY1zMcJEXCDhxF~oXZh#s)wg%9TF-%8*4<)LOmR3Upyt>OILz4I5?u+BQhtNkV}a^Yd8Mij+h o`|+qMO3h2mg@#d;()ziQ95>=@ymKdJ&CV&d2|YOh0CHE-ST`xJ>;M1& diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/3f/7bd8f68987d4e16b8f6fa7f6b0738b42180d1f b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/3f/7bd8f68987d4e16b8f6fa7f6b0738b42180d1f deleted file mode 100644 index 01335af9cb1ba115d2ffd38c8c9b43e84684e6bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 mcmbUlF$Df&Hw6H`gA3~b diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/48/f9387742d3cc3017c1a7e292c9187e35321753 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/48/f9387742d3cc3017c1a7e292c9187e35321753 deleted file mode 100644 index 96d96c7feaad918f388df7977912d1f7a8281c57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmb8WW6uBp$r=m% diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/4d/8452fc76beed0c7b15e40e45d06922bf746c5f b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/4d/8452fc76beed0c7b15e40e45d06922bf746c5f deleted file mode 100644 index 879dad0ba70403c3523afea0d80ea35925ce7065..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20 bcmb8GGQ<@FfcPQQAo-!$mS^zyl_RUn&4(-fHMw`@w|6l|lg{!R|4R9ralPl!OQ_Q1jKsY3RNa)+oYaz3 zu(|Hja!;*zSDe?WKD#r1eLMTT&OR0t#VNWa8L7Dtm*|!jgEh@vw|-}v&liKxb(8mP zSby#KMVI|cpqd~?>q0C7D_;0uj{dFmoj;V;%+AiUU{gQ5LL*IRcknZcklcKHmtLb@oK+` xi(GivsS!mn*nT{!ic<3ubD=)3Qd&P(lH*34jd$+Etl2rmHlZgc001r?*QL_BwVeO} diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/5a/d28e22767f979da2c198dc6c1003b25964e3da b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/5a/d28e22767f979da2c198dc6c1003b25964e3da deleted file mode 100644 index a49384ff604c8486178beafbf3cf566283daef9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20 bcmbATBS!MzNbrcA{ diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/7a/22af9d1908d85e3c4b6d916a9b6c733c55c990 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/7a/22af9d1908d85e3c4b6d916a9b6c733c55c990 deleted file mode 100644 index d248b43e804b22aa8a33283b729c49d1f5b38a4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 mcmbPxl`9;03w$vxH_2$wGw5! zrfi7=s>I-eQ^`UPKS^>^!o?@iAf+&2E<>^JTdg2y7|!lrNEsIxxz`>QE!`!6Kuz5@R*<9I%_e1no3wS DiEd%_ diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/89/44a13fdfc597e4cf1d23797df51977680f8e77 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/89/44a13fdfc597e4cf1d23797df51977680f8e77 deleted file mode 100644 index 7bba19849cee224f475b9bf893981b9124de3177..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb%!0b9!l!TPNxDVBm?1>;_~r<1-lC|2S6Z!) zp)tZ?bPvXiEIGv!Y%40gcT;3WGolK+&$}6xjC+s}iaYANpq z#PQa4cjyr{jR|$l1Dct}l`>^TcFk@QBeRGO!G7&kcbFG=%**6|E8EBKsg@^@kcv{z W3>_h2IO{oSevyaz^>6@AL@MSxYc~M^ diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/99/76d7948def8b082e9d20135d6a04624d711752 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/99/76d7948def8b082e9d20135d6a04624d711752 deleted file mode 100644 index c5f360872..000000000 --- a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/99/76d7948def8b082e9d20135d6a04624d711752 +++ /dev/null @@ -1 +0,0 @@ -xAj0E)f_4*YJ!c uo{ū[7)7 s GK12Q1\UY2ؼEU] O[.W:__xIq[$bbsn81eg>͖QqAO2:֤C鶒BG[Ǻ}/~L \ No newline at end of file diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 deleted file mode 100644 index 4667dcf6f2b51dda01be1dd1679b0195ab0e185a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20 bcmbXAvH$=8 diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/a1/be04124078e38a592c153942bf75edf210f1ed b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/a1/be04124078e38a592c153942bf75edf210f1ed deleted file mode 100644 index 72043ce4795e744924a7c22e53baeb2bf78cc511..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48 zcmbs`XRn& E0H^H!-*X;ky#1dtF$6`jn*sp12Mb34 diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/ab/addc0b9edd523c69166a2c9f3a9e31a4c873e3 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/ab/addc0b9edd523c69166a2c9f3a9e31a4c873e3 deleted file mode 100644 index 7ce146a5a77b54048c196767d8dc96e278a42107..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19 acmb8GGQ<@FfcPQQAkWlNlno$$wN*Ly@ zTfei-=Zit;y2<-CtiN{rqRajzP)$ksB^kQ8`5>)erB^O)s|<|LDwPrXU$8{b`6T+6y4&IM4+p|s#mYQ!#(eAkWHpomd<>ud4@|)6hB5&4e}{i zZPcYcrLy|za~B<)aVJNBc~fM{<6CHIp#d>JP~x3pR-Q{yGwV+_;|&KMtyPXeRY}nD z{L-YHROAq|ufFlEv;E4$?Ed`a-!>F?J4x`$L(PPQE3&uL8qVL{JAZ)<>#SqE+Hc|_ v7an$ML{SX3ACIb{)V#!8Xc$!~t)DB&aU;&gJ9lE%?3`ko(32AY=}OgreRi)< diff --git a/test/integration/discardFileChanges/expected/repo/.git_keep/objects/d4/d1b67951582a751c12ff7ea29ede7d37fd9ee8 b/test/integration/discardFileChanges/expected/repo/.git_keep/objects/d4/d1b67951582a751c12ff7ea29ede7d37fd9ee8 deleted file mode 100644 index 901facc5d0f38e8d6f7a8343b5bc8c5da36fe55c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27 jcmb8GGQ<@FfcPQQAo-!$vy*Kd@%@JH+kQN_1BJHblJZIstIDWF2o|R;)M_9=-*1; z`QwTUL-B#b_Ia)uvujWkr|1@!B&I_hzk2N*?s<2EY%;~Nbmm*lGhA|__%WJlkbA%; zM_uYuDyyG9chSKacX9-nH$|pAzJ;b1>frf-67LkV@?46VS%0z_Z#eL1t#S;iO0a?W zEYB}Z%1K2IX8Y both-deleted.txt -git checkout -b conflict && git add both-deleted.txt -echo bothmodded > both-modded.txt && git add both-modded.txt -echo haha > deleted-them.txt && git add deleted-them.txt -echo haha2 > deleted-us.txt && git add deleted-us.txt -echo mod > modded.txt & git add modded.txt -echo mod > modded-staged.txt & git add modded-staged.txt -echo del > deleted.txt && git add deleted.txt -echo del > deleted-staged.txt && git add deleted-staged.txt -echo change-delete > change-delete.txt && git add change-delete.txt -echo delete-change > delete-change.txt && git add delete-change.txt -echo double-modded > double-modded.txt && git add double-modded.txt -echo "renamed\nhaha" > renamed.txt && git add renamed.txt -git commit -m one - -# stuff on other branch -git branch conflict_second && git mv both-deleted.txt added-them-changed-us.txt -git commit -m "both-deleted.txt renamed in added-them-changed-us.txt" -echo blah > both-added.txt && git add both-added.txt -echo mod1 > both-modded.txt && git add both-modded.txt -rm deleted-them.txt && git add deleted-them.txt -echo modded > deleted-us.txt && git add deleted-us.txt -git commit -m "two" - -# stuff on our branch -git checkout conflict_second -git mv both-deleted.txt changed-them-added-us.txt -git commit -m "both-deleted.txt renamed in changed-them-added-us.txt" -echo mod2 > both-modded.txt && git add both-modded.txt -echo blah2 > both-added.txt && git add both-added.txt -echo modded > deleted-them.txt && git add deleted-them.txt -rm deleted-us.txt && git add deleted-us.txt -git commit -m "three" -git reset --hard conflict_second -git merge conflict - -echo "new" > new.txt -echo "new staged" > new-staged.txt && git add new-staged.txt -echo mod2 > modded.txt -echo mod2 > modded-staged.txt && git add modded-staged.txt -rm deleted.txt -rm deleted-staged.txt && git add deleted-staged.txt -echo change-delete2 > change-delete.txt && git add change-delete.txt -rm change-delete.txt -rm delete-change.txt && git add delete-change.txt -echo "changed" > delete-change.txt -echo "change1" > double-modded.txt && git add double-modded.txt -echo "change2" > double-modded.txt -echo before > added-changed.txt && git add added-changed.txt -echo after > added-changed.txt -rm renamed.txt && git add renamed.txt -echo "renamed\nhaha" > renamed2.txt && git add renamed2.txt diff --git a/test/integration/discardFileChanges/test.json b/test/integration/discardFileChanges/test.json deleted file mode 100644 index 8b82a5184..000000000 --- a/test/integration/discardFileChanges/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "discard file changes for various kinds of situations (merge conflicts, etc). Skipped because it's failing on CI for some reason", "speed": 5, "skip": true } From 13639ac924ba3a5606568d193213ea92264db259 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 09:55:33 +1100 Subject: [PATCH 4/9] faster test --- pkg/integration/components/assert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/integration/components/assert.go b/pkg/integration/components/assert.go index c1ae4cdd2..f2a3137f6 100644 --- a/pkg/integration/components/assert.go +++ b/pkg/integration/components/assert.go @@ -247,7 +247,7 @@ func (self *Assert) matchString(matcher *matcher, context string, getValue func( } func (self *Assert) assertWithRetries(test func() (bool, string)) { - waitTimes := []int{0, 1, 5, 10, 200, 500, 1000, 2000, 4000} + waitTimes := []int{0, 1, 1, 1, 1, 1, 5, 10, 20, 40, 100, 200, 500, 1000, 2000, 4000} var message string for _, waitTime := range waitTimes { From 588850b0902cff048efd1a5943ac7e8bf85db973 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 09:55:54 +1100 Subject: [PATCH 5/9] focus terminal when running a test --- .vscode/tasks.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 062eb0051..36274763c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -29,6 +29,9 @@ "group": { "kind": "test", "isDefault": true + }, + "presentation": { + "focus": true } }, { @@ -38,6 +41,9 @@ "problemMatcher": [], "group": { "kind": "test", + }, + "presentation": { + "focus": true } }, { @@ -47,6 +53,9 @@ "problemMatcher": [], "group": { "kind": "test", + }, + "presentation": { + "focus": true } } ], From fa97b0c76ee342c13aef6ddd5b06584f4c0dcbff Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 09:56:27 +1100 Subject: [PATCH 6/9] move background code into its own file --- pkg/gui/background.go | 71 +++++++++++++++++++++++++++++++++++++++++++ pkg/gui/gui.go | 60 +----------------------------------- 2 files changed, 72 insertions(+), 59 deletions(-) create mode 100644 pkg/gui/background.go diff --git a/pkg/gui/background.go b/pkg/gui/background.go new file mode 100644 index 000000000..6deac3c31 --- /dev/null +++ b/pkg/gui/background.go @@ -0,0 +1,71 @@ +package gui + +import ( + "strings" + "time" + + "github.com/jesseduffield/lazygit/pkg/utils" +) + +func (gui *Gui) startBackgroundRoutines() { + userConfig := gui.UserConfig + + if userConfig.Git.AutoFetch { + fetchInterval := userConfig.Refresher.FetchInterval + if fetchInterval > 0 { + go utils.Safe(gui.startBackgroundFetch) + } else { + gui.c.Log.Errorf( + "Value of config option 'refresher.fetchInterval' (%d) is invalid, disabling auto-fetch", + fetchInterval) + } + } + + if userConfig.Git.AutoRefresh { + refreshInterval := userConfig.Refresher.RefreshInterval + if refreshInterval > 0 { + gui.goEvery(time.Second*time.Duration(refreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules) + } else { + gui.c.Log.Errorf( + "Value of config option 'refresher.refreshInterval' (%d) is invalid, disabling auto-refresh", + refreshInterval) + } + } +} + +func (gui *Gui) startBackgroundFetch() { + gui.waitForIntro.Wait() + isNew := gui.IsNewRepo + userConfig := gui.UserConfig + if !isNew { + time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second) + } + err := gui.backgroundFetch() + if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew { + _ = gui.c.Alert(gui.c.Tr.NoAutomaticGitFetchTitle, gui.c.Tr.NoAutomaticGitFetchBody) + } else { + gui.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), gui.stopChan, func() error { + err := gui.backgroundFetch() + gui.render() + return err + }) + } +} + +func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function func() error) { + go utils.Safe(func() { + ticker := time.NewTicker(interval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + if gui.PauseBackgroundThreads { + continue + } + _ = function() + case <-stop: + return + } + } + }) +} diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 4fb5cca95..1431f6c16 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -7,7 +7,6 @@ import ( "os" "strings" "sync" - "time" "github.com/jesseduffield/gocui" appTypes "github.com/jesseduffield/lazygit/pkg/app/types" @@ -527,27 +526,7 @@ func (gui *Gui) Run(startArgs appTypes.StartArgs) error { gui.waitForIntro.Add(1) - if userConfig.Git.AutoFetch { - fetchInterval := userConfig.Refresher.FetchInterval - if fetchInterval > 0 { - go utils.Safe(gui.startBackgroundFetch) - } else { - gui.c.Log.Errorf( - "Value of config option 'refresher.fetchInterval' (%d) is invalid, disabling auto-fetch", - fetchInterval) - } - } - - if userConfig.Git.AutoRefresh { - refreshInterval := userConfig.Refresher.RefreshInterval - if refreshInterval > 0 { - gui.goEvery(time.Second*time.Duration(refreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules) - } else { - gui.c.Log.Errorf( - "Value of config option 'refresher.refreshInterval' (%d) is invalid, disabling auto-refresh", - refreshInterval) - } - } + gui.startBackgroundRoutines() gui.c.Log.Info("starting main loop") @@ -722,43 +701,6 @@ func (gui *Gui) showIntroPopupMessage(done chan struct{}) error { }) } -func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function func() error) { - go utils.Safe(func() { - ticker := time.NewTicker(interval) - defer ticker.Stop() - for { - select { - case <-ticker.C: - if gui.PauseBackgroundThreads { - continue - } - _ = function() - case <-stop: - return - } - } - }) -} - -func (gui *Gui) startBackgroundFetch() { - gui.waitForIntro.Wait() - isNew := gui.IsNewRepo - userConfig := gui.UserConfig - if !isNew { - time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second) - } - err := gui.backgroundFetch() - if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew { - _ = gui.c.Alert(gui.c.Tr.NoAutomaticGitFetchTitle, gui.c.Tr.NoAutomaticGitFetchBody) - } else { - gui.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), gui.stopChan, func() error { - err := gui.backgroundFetch() - gui.render() - return err - }) - } -} - // setColorScheme sets the color scheme for the app based on the user config func (gui *Gui) setColorScheme() error { userConfig := gui.UserConfig From c19f52255c1d5496713e4f4caba47382fd10c9fc Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 17:01:07 +1100 Subject: [PATCH 7/9] add task for opening deprecated tests TUI --- .vscode/tasks.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 36274763c..5be637f47 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -57,6 +57,18 @@ "presentation": { "focus": true } + }, + { + "label": "Open deprecated test TUI", + "type": "shell", + "command": "go run pkg/integration/deprecated/cmd/tui/main.go", + "problemMatcher": [], + "group": { + "kind": "test", + }, + "presentation": { + "focus": true + } } ], } From aedfce28459bc59865b516dba2ee480a5d0972f1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 17:01:26 +1100 Subject: [PATCH 8/9] refactor to not have Match at the start of assert method names, because it reads better that way --- pkg/integration/components/assert.go | 14 ++++---- pkg/integration/components/input.go | 10 +++--- pkg/integration/tests/bisect/basic.go | 30 ++++++++-------- .../tests/bisect/from_other_branch.go | 24 ++++++------- .../tests/branch/checkout_by_name.go | 10 +++--- pkg/integration/tests/branch/delete.go | 12 +++---- pkg/integration/tests/branch/rebase.go | 18 +++++----- .../tests/branch/rebase_and_drop.go | 28 +++++++-------- pkg/integration/tests/branch/reset.go | 16 ++++----- pkg/integration/tests/branch/suggestions.go | 2 +- .../tests/cherry_pick/cherry_pick.go | 26 +++++++------- .../cherry_pick/cherry_pick_conflicts.go | 36 +++++++++---------- pkg/integration/tests/commit/commit.go | 2 +- .../tests/commit/commit_multiline.go | 4 +-- pkg/integration/tests/commit/new_branch.go | 2 +- pkg/integration/tests/commit/revert.go | 8 ++--- pkg/integration/tests/commit/staged.go | 2 +- .../tests/commit/staged_without_hooks.go | 2 +- pkg/integration/tests/commit/unstaged.go | 2 +- .../tests/commit/unstaged_without_hooks.go | 2 +- .../tests/custom_commands/basic.go | 2 +- .../tests/custom_commands/form_prompts.go | 14 ++++---- .../custom_commands/menu_from_command.go | 12 +++---- .../menu_from_commands_output.go | 8 ++--- .../tests/custom_commands/multiple_prompts.go | 14 ++++---- pkg/integration/tests/diff/diff.go | 24 ++++++------- .../tests/diff/diff_and_apply_patch.go | 30 ++++++++-------- pkg/integration/tests/diff/diff_commits.go | 18 +++++----- .../tests/file/dir_with_untracked_file.go | 4 +-- pkg/integration/tests/file/discard_changes.go | 10 +++--- .../tests/interactive_rebase/amend_merge.go | 8 ++--- .../tests/interactive_rebase/one.go | 8 ++--- pkg/integration/tests/misc/confirm_on_quit.go | 2 +- pkg/integration/tests/stash/rename.go | 8 ++--- pkg/integration/tests/stash/stash.go | 2 +- .../stash/stash_including_untracked_files.go | 2 +- 36 files changed, 208 insertions(+), 208 deletions(-) diff --git a/pkg/integration/components/assert.go b/pkg/integration/components/assert.go index f2a3137f6..ab7d079c8 100644 --- a/pkg/integration/components/assert.go +++ b/pkg/integration/components/assert.go @@ -115,7 +115,7 @@ func (self *Assert) AtLeastOneCommit() { }) } -func (self *Assert) MatchHeadCommitMessage(matcher *matcher) { +func (self *Assert) HeadCommitMessage(matcher *matcher) { self.assertWithRetries(func() (bool, string) { return len(self.gui.Model().Commits) > 0, "Expected at least one commit to be present" }) @@ -156,7 +156,7 @@ func (self *Assert) InListContext() { }) } -func (self *Assert) MatchSelectedLine(matcher *matcher) { +func (self *Assert) SelectedLine(matcher *matcher) { self.matchString(matcher, "Unexpected selected line.", func() string { return self.gui.CurrentContext().GetView().SelectedLine() @@ -199,7 +199,7 @@ func (self *Assert) NotInPopup() { }) } -func (self *Assert) MatchCurrentViewTitle(matcher *matcher) { +func (self *Assert) CurrentViewTitle(matcher *matcher) { self.matchString(matcher, "Unexpected current view title.", func() string { return self.gui.CurrentContext().GetView().Title @@ -207,7 +207,7 @@ func (self *Assert) MatchCurrentViewTitle(matcher *matcher) { ) } -func (self *Assert) MatchViewContent(viewName string, matcher *matcher) { +func (self *Assert) ViewContent(viewName string, matcher *matcher) { self.matchString(matcher, fmt.Sprintf("Unexpected content in view '%s'.", viewName), func() string { return self.gui.View(viewName).Buffer() @@ -215,7 +215,7 @@ func (self *Assert) MatchViewContent(viewName string, matcher *matcher) { ) } -func (self *Assert) MatchCurrentViewContent(matcher *matcher) { +func (self *Assert) CurrentViewContent(matcher *matcher) { self.matchString(matcher, "Unexpected content in current view.", func() string { return self.gui.CurrentContext().GetView().Buffer() @@ -223,7 +223,7 @@ func (self *Assert) MatchCurrentViewContent(matcher *matcher) { ) } -func (self *Assert) MatchMainViewContent(matcher *matcher) { +func (self *Assert) MainViewContent(matcher *matcher) { self.matchString(matcher, "Unexpected main view content.", func() string { return self.gui.MainView().Buffer() @@ -231,7 +231,7 @@ func (self *Assert) MatchMainViewContent(matcher *matcher) { ) } -func (self *Assert) MatchSecondaryViewContent(matcher *matcher) { +func (self *Assert) SecondaryViewContent(matcher *matcher) { self.matchString(matcher, "Unexpected secondary view title.", func() string { return self.gui.SecondaryView().Buffer() diff --git a/pkg/integration/components/input.go b/pkg/integration/components/input.go index 61b0f771f..adc4df261 100644 --- a/pkg/integration/components/input.go +++ b/pkg/integration/components/input.go @@ -78,7 +78,7 @@ func (self *Input) Confirm() { func (self *Input) ProceedWhenAsked(matcher *matcher) { self.assert.InConfirm() - self.assert.MatchCurrentViewContent(matcher) + self.assert.CurrentViewContent(matcher) self.Confirm() } @@ -109,7 +109,7 @@ func (self *Input) PreviousItem() { func (self *Input) ContinueMerge() { self.PressKeys(self.keys.Universal.CreateRebaseOptionsMenu) - self.assert.MatchSelectedLine(Contains("continue")) + self.assert.SelectedLine(Contains("continue")) self.Confirm() } @@ -171,20 +171,20 @@ func (self *Input) NavigateToListItemContainingText(text string) { selectedLineIdx := view.SelectedLineIdx() if selectedLineIdx == matchIndex { - self.assert.MatchSelectedLine(Contains(text)) + self.assert.SelectedLine(Contains(text)) return } if selectedLineIdx < matchIndex { for i := selectedLineIdx; i < matchIndex; i++ { self.NextItem() } - self.assert.MatchSelectedLine(Contains(text)) + self.assert.SelectedLine(Contains(text)) return } else { for i := selectedLineIdx; i > matchIndex; i-- { self.PreviousItem() } - self.assert.MatchSelectedLine(Contains(text)) + self.assert.SelectedLine(Contains(text)) return } } diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index 0c9494b82..0b81bbcb3 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -26,16 +26,16 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ } markCommitAsBad := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.Confirm() } markCommitAsGood := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.NextItem() - assert.MatchSelectedLine(Contains("good")) + assert.SelectedLine(Contains("good")) input.Confirm() } @@ -44,16 +44,16 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("commit 10")) + assert.SelectedLine(Contains("commit 10")) input.NavigateToListItemContainingText("commit 09") markCommitAsBad() - assert.MatchViewContent("information", Contains("bisecting")) + assert.ViewContent("information", Contains("bisecting")) assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("<-- bad")) + assert.SelectedLine(Contains("<-- bad")) input.NavigateToListItemContainingText("commit 02") @@ -61,26 +61,26 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ // lazygit will land us in the comit between our good and bad commits. assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("commit 05")) - assert.MatchSelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 05")) + assert.SelectedLine(Contains("<-- current")) markCommitAsBad() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("commit 04")) - assert.MatchSelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 04")) + assert.SelectedLine(Contains("<-- current")) markCommitAsGood() assert.InAlert() - assert.MatchCurrentViewContent(Contains("Bisect complete!")) + assert.CurrentViewContent(Contains("Bisect complete!")) // commit 5 is the culprit because we marked 4 as good and 5 as bad. - assert.MatchCurrentViewContent(Contains("commit 05")) - assert.MatchCurrentViewContent(Contains("Do you want to reset")) + assert.CurrentViewContent(Contains("commit 05")) + assert.CurrentViewContent(Contains("Do you want to reset")) input.Confirm() assert.CurrentViewName("commits") - assert.MatchCurrentViewContent(Contains("commit 04")) - assert.MatchViewContent("information", NotContains("bisecting")) + assert.CurrentViewContent(Contains("commit 04")) + assert.ViewContent("information", NotContains("bisecting")) }, }) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 4ef9a4d73..52314518f 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -31,39 +31,39 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ markCommitAsGood := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.NextItem() - assert.MatchSelectedLine(Contains("good")) + assert.SelectedLine(Contains("good")) input.Confirm() } - assert.MatchViewContent("information", Contains("bisecting")) + assert.ViewContent("information", Contains("bisecting")) assert.AtLeastOneCommit() input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("<-- bad")) - assert.MatchSelectedLine(Contains("commit 08")) + assert.SelectedLine(Contains("<-- bad")) + assert.SelectedLine(Contains("commit 08")) input.NextItem() - assert.MatchSelectedLine(Contains("<-- current")) - assert.MatchSelectedLine(Contains("commit 07")) + assert.SelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 07")) markCommitAsGood() assert.InAlert() - assert.MatchCurrentViewContent(Contains("Bisect complete!")) - assert.MatchCurrentViewContent(Contains("commit 08")) - assert.MatchCurrentViewContent(Contains("Do you want to reset")) + assert.CurrentViewContent(Contains("Bisect complete!")) + assert.CurrentViewContent(Contains("commit 08")) + assert.CurrentViewContent(Contains("Do you want to reset")) input.Confirm() - assert.MatchViewContent("information", NotContains("bisecting")) + assert.ViewContent("information", NotContains("bisecting")) // back in master branch which just had the one commit assert.CurrentViewName("commits") assert.CommitCount(1) - assert.MatchSelectedLine(Contains("only commit on master")) + assert.SelectedLine(Contains("only commit on master")) }, }) diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index 4888b0112..956a2c36b 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -21,19 +21,19 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("master")) + assert.SelectedLine(Contains("master")) input.NextItem() - assert.MatchSelectedLine(Contains("@")) + assert.SelectedLine(Contains("@")) input.PressKeys(keys.Branches.CheckoutBranchByName) assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Branch name:")) + assert.CurrentViewTitle(Equals("Branch name:")) input.Type("new-branch") input.Confirm() assert.InAlert() - assert.MatchCurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?")) + assert.CurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("new-branch")) + assert.SelectedLine(Contains("new-branch")) }, }) diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 46df9a457..148544563 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -20,21 +20,21 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("branch-two")) + assert.SelectedLine(Contains("branch-two")) input.PressKeys(keys.Universal.Remove) assert.InAlert() - assert.MatchCurrentViewContent(Contains("You cannot delete the checked out branch!")) + assert.CurrentViewContent(Contains("You cannot delete the checked out branch!")) input.Confirm() input.NextItem() - assert.MatchSelectedLine(Contains("branch-one")) + assert.SelectedLine(Contains("branch-one")) input.PressKeys(keys.Universal.Remove) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?")) + assert.CurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("master")) - assert.MatchCurrentViewContent(NotContains("branch-one")) + assert.SelectedLine(Contains("master")) + assert.CurrentViewContent(NotContains("branch-one")) }, }) diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index f894c42cb..a398b0993 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -18,21 +18,21 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.PressKeys(keys.Branches.RebaseBranch) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) + assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) input.Confirm() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke @@ -41,13 +41,13 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("mergeConflicts") input.PrimaryAction() - assert.MatchViewContent("information", Contains("rebasing")) + assert.ViewContent("information", Contains("rebasing")) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() - assert.MatchViewContent("information", NotContains("rebasing")) + assert.ViewContent("information", NotContains("rebasing")) // this proves we actually have integrated the changes from second-change-branch - assert.MatchViewContent("commits", Contains("second-change-branch unrelated change")) + assert.ViewContent("commits", Contains("second-change-branch unrelated change")) }, }) diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 5600997b3..2269f0292 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -21,30 +21,30 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.PressKeys(keys.Branches.RebaseBranch) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) + assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) input.Confirm() - assert.MatchViewContent("information", Contains("rebasing")) + assert.ViewContent("information", Contains("rebasing")) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("pick")) // this means it's a rebasing commit + assert.SelectedLine(Contains("pick")) // this means it's a rebasing commit input.NextItem() input.PressKeys(keys.Universal.Remove) - assert.MatchSelectedLine(Contains("to remove")) - assert.MatchSelectedLine(Contains("drop")) + assert.SelectedLine(Contains("to remove")) + assert.SelectedLine(Contains("drop")) input.SwitchToFilesWindow() @@ -56,14 +56,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ input.PrimaryAction() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() - assert.MatchViewContent("information", NotContains("rebasing")) + assert.ViewContent("information", NotContains("rebasing")) // this proves we actually have integrated the changes from second-change-branch - assert.MatchViewContent("commits", Contains("second-change-branch unrelated change")) - assert.MatchViewContent("commits", Contains("to keep")) - assert.MatchViewContent("commits", NotContains("to remove")) + assert.ViewContent("commits", Contains("second-change-branch unrelated change")) + assert.ViewContent("commits", Contains("to keep")) + assert.ViewContent("commits", NotContains("to remove")) }, }) diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index 344c1b821..605b7e76c 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -24,19 +24,19 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("current-branch")) + assert.SelectedLine(Contains("current-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("other-branch")) + assert.SelectedLine(Contains("other-branch")) input.PressKeys(keys.Commits.ViewResetOptions) assert.InMenu() - assert.MatchCurrentViewTitle(Contains("reset to other-branch")) + assert.CurrentViewTitle(Contains("reset to other-branch")) - assert.MatchSelectedLine(Contains("soft reset")) + assert.SelectedLine(Contains("soft reset")) input.NextItem() - assert.MatchSelectedLine(Contains("mixed reset")) + assert.SelectedLine(Contains("mixed reset")) input.NextItem() - assert.MatchSelectedLine(Contains("hard reset")) + assert.SelectedLine(Contains("hard reset")) input.Confirm() @@ -47,8 +47,8 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.CommitCount(2) - assert.MatchSelectedLine(Contains("other-branch commit")) + assert.SelectedLine(Contains("other-branch commit")) input.NextItem() - assert.MatchSelectedLine(Contains("root commit")) + assert.SelectedLine(Contains("root commit")) }, }) diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 7f7f7e8cb..346c471d0 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -34,7 +34,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in - assert.MatchSelectedLine(Contains("branch-to-checkout")) + assert.SelectedLine(Contains("branch-to-checkout")) input.Confirm() assert.CurrentBranchName("branch-to-checkout") diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 0f5715434..7cbf6a70a 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -27,40 +27,40 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-branch")) + assert.SelectedLine(Contains("first-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-branch")) + assert.SelectedLine(Contains("second-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchSelectedLine(Contains("four")) + assert.SelectedLine(Contains("four")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("1 commit copied")) + assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() - assert.MatchSelectedLine(Contains("three")) + assert.SelectedLine(Contains("three")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("two")) + assert.SelectedLine(Contains("two")) input.PressKeys(keys.Commits.PasteCommits) assert.InAlert() - assert.MatchCurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) input.Confirm() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("four")) + assert.SelectedLine(Contains("four")) input.NextItem() - assert.MatchSelectedLine(Contains("three")) + assert.SelectedLine(Contains("three")) input.NextItem() - assert.MatchSelectedLine(Contains("two")) + assert.SelectedLine(Contains("two")) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.PressKeys(keys.Universal.Return) - assert.MatchViewContent("information", NotContains("commits copied")) + assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index e747d8e4d..99005ad8e 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -18,37 +18,37 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchSelectedLine(Contains("second-change-branch unrelated change")) + assert.SelectedLine(Contains("second-change-branch unrelated change")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("1 commit copied")) + assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() - assert.MatchSelectedLine(Contains("second change")) + assert.SelectedLine(Contains("second change")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("first change")) + assert.SelectedLine(Contains("first change")) input.PressKeys(keys.Commits.PasteCommits) assert.InAlert() - assert.MatchCurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) input.Confirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke @@ -60,7 +60,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.PrimaryAction() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() assert.CurrentViewName("files") @@ -69,19 +69,19 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("second-change-branch unrelated change")) + assert.SelectedLine(Contains("second-change-branch unrelated change")) input.NextItem() - assert.MatchSelectedLine(Contains("second change")) + assert.SelectedLine(Contains("second change")) // because we picked 'Second change' when resolving the conflict, // we now see this commit as having replaced First Change with Second Change, // as opposed to replacing 'Original' with 'Second change' - assert.MatchMainViewContent(Contains("-First Change")) - assert.MatchMainViewContent(Contains("+Second Change")) + assert.MainViewContent(Contains("-First Change")) + assert.MainViewContent(Contains("+Second Change")) input.NextItem() - assert.MatchSelectedLine(Contains("first change")) + assert.SelectedLine(Contains("first change")) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.PressKeys(keys.Universal.Return) - assert.MatchViewContent("information", NotContains("commits copied")) + assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index dbef083ae..1b7c42793 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -27,6 +27,6 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.HeadCommitMessage(Equals(commitMessage)) }, }) diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index f6472dd33..15f26d15d 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -26,9 +26,9 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals("first line")) + assert.HeadCommitMessage(Equals("first line")) input.SwitchToCommitsWindow() - assert.MatchMainViewContent(MatchesRegexp("first line\n\\s*\n\\s*third line")) + assert.MainViewContent(MatchesRegexp("first line\n\\s*\n\\s*third line")) }, }) diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go index ea784791d..6cf77e89f 100644 --- a/pkg/integration/tests/commit/new_branch.go +++ b/pkg/integration/tests/commit/new_branch.go @@ -32,7 +32,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(2) - assert.MatchHeadCommitMessage(Contains("commit 2")) + assert.HeadCommitMessage(Contains("commit 2")) assert.CurrentBranchName(branchName) }, }) diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go index c42c7af53..c0fccbb60 100644 --- a/pkg/integration/tests/commit/revert.go +++ b/pkg/integration/tests/commit/revert.go @@ -22,14 +22,14 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys(keys.Commits.RevertCommit) assert.InConfirm() - assert.MatchCurrentViewTitle(Equals("Revert commit")) - assert.MatchCurrentViewContent(MatchesRegexp("Are you sure you want to revert \\w+?")) + assert.CurrentViewTitle(Equals("Revert commit")) + assert.CurrentViewContent(MatchesRegexp("Are you sure you want to revert \\w+?")) input.Confirm() assert.CommitCount(2) - assert.MatchHeadCommitMessage(Contains("Revert \"first commit\"")) + assert.HeadCommitMessage(Contains("Revert \"first commit\"")) input.PreviousItem() - assert.MatchMainViewContent(Contains("-myfile content")) + assert.MainViewContent(Contains("-myfile content")) assert.FileSystemPathNotPresent("myfile") input.Wait(10) diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index 715bc0eb2..2ed52d011 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -28,7 +28,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.HeadCommitMessage(Equals(commitMessage)) assert.CurrentWindowName("stagingSecondary") }, }) diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go index e1466f8d2..5d8e400b9 100644 --- a/pkg/integration/tests/commit/staged_without_hooks.go +++ b/pkg/integration/tests/commit/staged_without_hooks.go @@ -28,7 +28,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals("WIP" + commitMessage)) + assert.HeadCommitMessage(Equals("WIP" + commitMessage)) assert.CurrentWindowName("stagingSecondary") }, }) diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index aa8579e2b..50700fd4e 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -27,7 +27,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.HeadCommitMessage(Equals(commitMessage)) assert.CurrentWindowName("staging") }, }) diff --git a/pkg/integration/tests/commit/unstaged_without_hooks.go b/pkg/integration/tests/commit/unstaged_without_hooks.go index 442316f60..e2b5123a5 100644 --- a/pkg/integration/tests/commit/unstaged_without_hooks.go +++ b/pkg/integration/tests/commit/unstaged_without_hooks.go @@ -27,7 +27,7 @@ var UnstagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals("WIP" + commitMessage)) + assert.HeadCommitMessage(Equals("WIP" + commitMessage)) assert.CurrentWindowName("staging") }, }) diff --git a/pkg/integration/tests/custom_commands/basic.go b/pkg/integration/tests/custom_commands/basic.go index e92e3eed3..13dffb513 100644 --- a/pkg/integration/tests/custom_commands/basic.go +++ b/pkg/integration/tests/custom_commands/basic.go @@ -31,6 +31,6 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.WorkingTreeFileCount(1) - assert.MatchSelectedLine(Contains("myfile")) + assert.SelectedLine(Contains("myfile")) }, }) diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go index 5d9403107..34970c21b 100644 --- a/pkg/integration/tests/custom_commands/form_prompts.go +++ b/pkg/integration/tests/custom_commands/form_prompts.go @@ -66,23 +66,23 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Enter a file name")) + assert.CurrentViewTitle(Equals("Enter a file name")) input.Type("my file") input.Confirm() assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Choose file content")) - assert.MatchSelectedLine(Contains("foo")) + assert.CurrentViewTitle(Equals("Choose file content")) + assert.SelectedLine(Contains("foo")) input.NextItem() - assert.MatchSelectedLine(Contains("bar")) + assert.SelectedLine(Contains("bar")) input.Confirm() assert.InConfirm() - assert.MatchCurrentViewTitle(Equals("Are you sure?")) + assert.CurrentViewTitle(Equals("Are you sure?")) input.Confirm() assert.WorkingTreeFileCount(1) - assert.MatchSelectedLine(Contains("my file")) - assert.MatchMainViewContent(Contains(`"BAR"`)) + assert.SelectedLine(Contains("my file")) + assert.MainViewContent(Contains(`"BAR"`)) }, }) diff --git a/pkg/integration/tests/custom_commands/menu_from_command.go b/pkg/integration/tests/custom_commands/menu_from_command.go index f45d820d6..dd5d8324a 100644 --- a/pkg/integration/tests/custom_commands/menu_from_command.go +++ b/pkg/integration/tests/custom_commands/menu_from_command.go @@ -54,21 +54,21 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Choose commit message")) - assert.MatchSelectedLine(Equals("baz")) + assert.CurrentViewTitle(Equals("Choose commit message")) + assert.SelectedLine(Equals("baz")) input.NextItem() - assert.MatchSelectedLine(Equals("bar")) + assert.SelectedLine(Equals("bar")) input.Confirm() assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Description")) + assert.CurrentViewTitle(Equals("Description")) input.Type(" my branch") input.Confirm() input.SwitchToFilesWindow() assert.WorkingTreeFileCount(1) - assert.MatchSelectedLine(Contains("output.txt")) - assert.MatchMainViewContent(Contains("bar Branch: #feature/foo my branch feature/foo")) + assert.SelectedLine(Contains("output.txt")) + assert.MainViewContent(Contains("bar Branch: #feature/foo my branch feature/foo")) }, }) diff --git a/pkg/integration/tests/custom_commands/menu_from_commands_output.go b/pkg/integration/tests/custom_commands/menu_from_commands_output.go index fdd207c4c..8224f507b 100644 --- a/pkg/integration/tests/custom_commands/menu_from_commands_output.go +++ b/pkg/integration/tests/custom_commands/menu_from_commands_output.go @@ -53,15 +53,15 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Which git command do you want to run?")) - assert.MatchSelectedLine(Equals("branch")) + assert.CurrentViewTitle(Equals("Which git command do you want to run?")) + assert.SelectedLine(Equals("branch")) input.Confirm() assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Branch:")) + assert.CurrentViewTitle(Equals("Branch:")) input.NextItem() input.NextItem() - assert.MatchSelectedLine(Equals("master")) + assert.SelectedLine(Equals("master")) input.Confirm() assert.CurrentBranchName("master") diff --git a/pkg/integration/tests/custom_commands/multiple_prompts.go b/pkg/integration/tests/custom_commands/multiple_prompts.go index e66b6a091..4b520933e 100644 --- a/pkg/integration/tests/custom_commands/multiple_prompts.go +++ b/pkg/integration/tests/custom_commands/multiple_prompts.go @@ -64,23 +64,23 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Enter a file name")) + assert.CurrentViewTitle(Equals("Enter a file name")) input.Type("myfile") input.Confirm() assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Choose file content")) - assert.MatchSelectedLine(Contains("foo")) + assert.CurrentViewTitle(Equals("Choose file content")) + assert.SelectedLine(Contains("foo")) input.NextItem() - assert.MatchSelectedLine(Contains("bar")) + assert.SelectedLine(Contains("bar")) input.Confirm() assert.InConfirm() - assert.MatchCurrentViewTitle(Equals("Are you sure?")) + assert.CurrentViewTitle(Equals("Are you sure?")) input.Confirm() assert.WorkingTreeFileCount(1) - assert.MatchSelectedLine(Contains("myfile")) - assert.MatchMainViewContent(Contains("BAR")) + assert.SelectedLine(Contains("myfile")) + assert.MainViewContent(Contains("BAR")) }, }) diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go index 9c23674a4..bbb93335d 100644 --- a/pkg/integration/tests/diff/diff.go +++ b/pkg/integration/tests/diff/diff.go @@ -25,28 +25,28 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("branch-a")) + assert.SelectedLine(Contains("branch-a")) input.PressKeys(keys.Universal.DiffingMenu) assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Diffing")) - assert.MatchSelectedLine(Contains("diff branch-a")) + assert.CurrentViewTitle(Equals("Diffing")) + assert.SelectedLine(Contains("diff branch-a")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-a")) + assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-a")) input.NextItem() - assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b")) - assert.MatchMainViewContent(Contains("+second line")) + assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-b")) + assert.MainViewContent(Contains("+second line")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchMainViewContent(Contains("+second line")) - assert.MatchSelectedLine(Contains("update")) + assert.MainViewContent(Contains("+second line")) + assert.SelectedLine(Contains("update")) input.Enter() assert.CurrentViewName("commitFiles") - assert.MatchSelectedLine(Contains("file1")) - assert.MatchMainViewContent(Contains("+second line")) + assert.SelectedLine(Contains("file1")) + assert.MainViewContent(Contains("+second line")) input.PressKeys(keys.Universal.Return) input.PressKeys(keys.Universal.Return) @@ -56,7 +56,7 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ assert.InMenu() input.NavigateToListItemContainingText("reverse diff direction") input.Confirm() - assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b -R")) - assert.MatchMainViewContent(Contains("-second line")) + assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-b -R")) + assert.MainViewContent(Contains("-second line")) }, }) diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go index 7c27b1517..5efd795e2 100644 --- a/pkg/integration/tests/diff/diff_and_apply_patch.go +++ b/pkg/integration/tests/diff/diff_and_apply_patch.go @@ -25,50 +25,50 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("branch-a")) + assert.SelectedLine(Contains("branch-a")) input.PressKeys(keys.Universal.DiffingMenu) assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Diffing")) - assert.MatchSelectedLine(Contains("diff branch-a")) + assert.CurrentViewTitle(Equals("Diffing")) + assert.SelectedLine(Contains("diff branch-a")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-a")) + assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-a")) input.NextItem() - assert.MatchViewContent("information", Contains("showing output for: git diff branch-a branch-b")) - assert.MatchMainViewContent(Contains("+second line")) + assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-b")) + assert.MainViewContent(Contains("+second line")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchMainViewContent(Contains("+second line")) - assert.MatchSelectedLine(Contains("update")) + assert.MainViewContent(Contains("+second line")) + assert.SelectedLine(Contains("update")) input.Enter() assert.CurrentViewName("commitFiles") - assert.MatchSelectedLine(Contains("file1")) - assert.MatchMainViewContent(Contains("+second line")) + assert.SelectedLine(Contains("file1")) + assert.MainViewContent(Contains("+second line")) // add the file to the patch input.PrimaryAction() input.PressKeys(keys.Universal.DiffingMenu) assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Diffing")) + assert.CurrentViewTitle(Equals("Diffing")) input.NavigateToListItemContainingText("exit diff mode") input.Confirm() - assert.MatchViewContent("information", NotContains("building patch")) + assert.ViewContent("information", NotContains("building patch")) input.PressKeys(keys.Universal.CreatePatchOptionsMenu) assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Patch Options")) + assert.CurrentViewTitle(Equals("Patch Options")) // including the keybinding 'a' here to distinguish the menu item from the 'apply patch in reverse' item input.NavigateToListItemContainingText("a apply patch") input.Confirm() input.SwitchToFilesWindow() - assert.MatchSelectedLine(Contains("file1")) - assert.MatchMainViewContent(Contains("+second line")) + assert.SelectedLine(Contains("file1")) + assert.MainViewContent(Contains("+second line")) }, }) diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go index bcf83d5c5..7425d7592 100644 --- a/pkg/integration/tests/diff/diff_commits.go +++ b/pkg/integration/tests/diff/diff_commits.go @@ -22,35 +22,35 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("third commit")) + assert.SelectedLine(Contains("third commit")) input.PressKeys(keys.Universal.DiffingMenu) assert.InMenu() - assert.MatchCurrentViewTitle(Equals("Diffing")) - assert.MatchSelectedLine(Contains("diff")) + assert.CurrentViewTitle(Equals("Diffing")) + assert.SelectedLine(Contains("diff")) input.Confirm() assert.NotInPopup() - assert.MatchViewContent("information", Contains("showing output for: git diff")) + assert.ViewContent("information", Contains("showing output for: git diff")) input.NextItem() input.NextItem() - assert.MatchSelectedLine(Contains("first commit")) + assert.SelectedLine(Contains("first commit")) - assert.MatchMainViewContent(Contains("-second line\n-third line")) + assert.MainViewContent(Contains("-second line\n-third line")) input.PressKeys(keys.Universal.DiffingMenu) assert.InMenu() input.NavigateToListItemContainingText("reverse diff direction") input.Confirm() - assert.MatchMainViewContent(Contains("+second line\n+third line")) + assert.MainViewContent(Contains("+second line\n+third line")) input.Enter() assert.CurrentViewName("commitFiles") - assert.MatchSelectedLine(Contains("file1")) - assert.MatchMainViewContent(Contains("+second line\n+third line")) + assert.SelectedLine(Contains("file1")) + assert.MainViewContent(Contains("+second line\n+third line")) }, }) diff --git a/pkg/integration/tests/file/dir_with_untracked_file.go b/pkg/integration/tests/file/dir_with_untracked_file.go index c67745c65..dc37798ee 100644 --- a/pkg/integration/tests/file/dir_with_untracked_file.go +++ b/pkg/integration/tests/file/dir_with_untracked_file.go @@ -24,9 +24,9 @@ var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(1) - assert.MatchMainViewContent(NotContains("error: Could not access")) + assert.MainViewContent(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")) + assert.MainViewContent(Contains("baz")) }, }) diff --git a/pkg/integration/tests/file/discard_changes.go b/pkg/integration/tests/file/discard_changes.go index ce2e2c65d..ad931a26b 100644 --- a/pkg/integration/tests/file/discard_changes.go +++ b/pkg/integration/tests/file/discard_changes.go @@ -8,7 +8,7 @@ import ( var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding all possible permutations of changed files", ExtraCmdArgs: "", - Skip: false, + Skip: true, // failing due to index.lock file being created SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { @@ -81,10 +81,10 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ discardOneByOne := func(files []statusFile) { for _, file := range files { - assert.MatchSelectedLine(Contains(file.status + " " + file.path)) + assert.SelectedLine(Contains(file.status + " " + file.path)) input.PressKeys(keys.Universal.Remove) assert.InMenu() - assert.MatchCurrentViewContent(Contains("discard all changes")) + assert.CurrentViewContent(Contains("discard all changes")) input.Confirm() } } @@ -100,8 +100,8 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ }) assert.InConfirm() - assert.MatchCurrentViewTitle(Contains("continue")) - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewTitle(Contains("continue")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.PressKeys(keys.Universal.Return) discardOneByOne([]statusFile{ diff --git a/pkg/integration/tests/interactive_rebase/amend_merge.go b/pkg/integration/tests/interactive_rebase/amend_merge.go index e01e79a78..c71bb1c9d 100644 --- a/pkg/integration/tests/interactive_rebase/amend_merge.go +++ b/pkg/integration/tests/interactive_rebase/amend_merge.go @@ -34,17 +34,17 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("commits") mergeCommitMessage := "Merge branch 'feature-branch' into development-branch" - assert.MatchHeadCommitMessage(Contains(mergeCommitMessage)) + assert.HeadCommitMessage(Contains(mergeCommitMessage)) input.PressKeys(keys.Commits.AmendToCommit) input.ProceedWhenAsked(Contains("Are you sure you want to amend this commit with your staged files?")) // assuring we haven't added a brand new commit assert.CommitCount(3) - assert.MatchHeadCommitMessage(Contains(mergeCommitMessage)) + assert.HeadCommitMessage(Contains(mergeCommitMessage)) // assuring the post-merge file shows up in the merge commit. - assert.MatchMainViewContent(Contains(postMergeFilename)) - assert.MatchMainViewContent(Contains("++" + postMergeFileContent)) + assert.MainViewContent(Contains(postMergeFilename)) + assert.MainViewContent(Contains("++" + postMergeFileContent)) }, }) diff --git a/pkg/integration/tests/interactive_rebase/one.go b/pkg/integration/tests/interactive_rebase/one.go index 014a4b8c9..4a8e697d9 100644 --- a/pkg/integration/tests/interactive_rebase/one.go +++ b/pkg/integration/tests/interactive_rebase/one.go @@ -20,19 +20,19 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ input.NavigateToListItemContainingText("commit 02") input.PressKeys(keys.Universal.Edit) - assert.MatchSelectedLine(Contains("YOU ARE HERE")) + assert.SelectedLine(Contains("YOU ARE HERE")) input.PreviousItem() input.PressKeys(keys.Commits.MarkCommitAsFixup) - assert.MatchSelectedLine(Contains("fixup")) + assert.SelectedLine(Contains("fixup")) input.PreviousItem() input.PressKeys(keys.Universal.Remove) - assert.MatchSelectedLine(Contains("drop")) + assert.SelectedLine(Contains("drop")) input.PreviousItem() input.PressKeys(keys.Commits.SquashDown) - assert.MatchSelectedLine(Contains("squash")) + assert.SelectedLine(Contains("squash")) input.ContinueRebase() diff --git a/pkg/integration/tests/misc/confirm_on_quit.go b/pkg/integration/tests/misc/confirm_on_quit.go index fc5ea9c5c..134c2cab5 100644 --- a/pkg/integration/tests/misc/confirm_on_quit.go +++ b/pkg/integration/tests/misc/confirm_on_quit.go @@ -19,7 +19,7 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys(keys.Universal.Quit) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to quit?")) + assert.CurrentViewContent(Contains("Are you sure you want to quit?")) input.Confirm() }, }) diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go index 761d7135b..3589c5a76 100644 --- a/pkg/integration/tests/stash/rename.go +++ b/pkg/integration/tests/stash/rename.go @@ -22,16 +22,16 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToStashWindow() assert.CurrentViewName("stash") - assert.MatchSelectedLine(Equals("On master: bar")) + assert.SelectedLine(Equals("On master: bar")) input.NextItem() - assert.MatchSelectedLine(Equals("On master: foo")) + assert.SelectedLine(Equals("On master: foo")) input.PressKeys(keys.Stash.RenameStash) assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Rename stash: stash@{1}")) + assert.CurrentViewTitle(Equals("Rename stash: stash@{1}")) input.Type(" baz") input.Confirm() - assert.MatchSelectedLine(Equals("On master: foo baz")) + assert.SelectedLine(Equals("On master: foo baz")) }, }) diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index 00d666168..766469a70 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -24,7 +24,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("a") assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Stash changes")) + assert.CurrentViewTitle(Equals("Stash changes")) input.Type("my stashed file") input.Confirm() diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go index 2f37f943c..998910f40 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -25,7 +25,7 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ input.PressKeys("U") assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Stash changes")) + assert.CurrentViewTitle(Equals("Stash changes")) input.Type("my stashed file") input.Confirm() From b623ecf898e1ac35b0a6093978203a7b5c13c42e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 24 Dec 2022 17:48:57 +1100 Subject: [PATCH 9/9] add helper functions for popups in tests --- pkg/integration/README.md | 20 +++- pkg/integration/components/assert.go | 78 ++++++------- pkg/integration/components/input.go | 108 ++++++++++++------ pkg/integration/components/matcher.go | 35 ++++++ pkg/integration/components/runner.go | 4 + pkg/integration/components/test_test.go | 8 +- pkg/integration/tests/bisect/basic.go | 30 ++--- .../tests/bisect/from_other_branch.go | 23 +--- .../tests/branch/checkout_by_name.go | 13 +-- pkg/integration/tests/branch/delete.go | 15 +-- pkg/integration/tests/branch/rebase.go | 18 ++- .../tests/branch/rebase_and_drop.go | 20 ++-- pkg/integration/tests/branch/reset.go | 12 +- pkg/integration/tests/branch/suggestions.go | 11 +- .../tests/cherry_pick/cherry_pick.go | 12 +- .../cherry_pick/cherry_pick_conflicts.go | 22 ++-- pkg/integration/tests/commit/commit.go | 3 +- .../tests/commit/commit_multiline.go | 7 +- pkg/integration/tests/commit/new_branch.go | 7 +- pkg/integration/tests/commit/revert.go | 9 +- pkg/integration/tests/commit/staged.go | 25 +++- .../tests/commit/staged_without_hooks.go | 31 ++++- pkg/integration/tests/commit/unstaged.go | 16 ++- .../tests/commit/unstaged_without_hooks.go | 33 ------ .../tests/custom_commands/basic.go | 2 +- .../tests/custom_commands/form_prompts.go | 18 +-- .../custom_commands/menu_from_command.go | 14 +-- .../menu_from_commands_output.go | 11 +- .../tests/custom_commands/multiple_prompts.go | 18 +-- pkg/integration/tests/diff/diff.go | 17 +-- .../tests/diff/diff_and_apply_patch.go | 24 ++-- pkg/integration/tests/diff/diff_commits.go | 15 +-- pkg/integration/tests/file/discard_changes.go | 52 ++++----- .../tests/interactive_rebase/amend_merge.go | 4 +- .../tests/interactive_rebase/one.go | 10 +- pkg/integration/tests/misc/confirm_on_quit.go | 7 +- pkg/integration/tests/stash/rename.go | 7 +- pkg/integration/tests/stash/stash.go | 11 +- .../stash/stash_including_untracked_files.go | 11 +- pkg/integration/tests/tests.go | 1 - 40 files changed, 380 insertions(+), 402 deletions(-) create mode 100644 pkg/integration/components/matcher.go delete mode 100644 pkg/integration/tests/commit/unstaged_without_hooks.go diff --git a/pkg/integration/README.md b/pkg/integration/README.md index 3c75792ed..96b7f0089 100644 --- a/pkg/integration/README.md +++ b/pkg/integration/README.md @@ -41,10 +41,28 @@ The run step has four arguments passed in: Try to do as much setup work as possible in your setup step. For example, if all you're testing is that the user is able to resolve merge conflicts, create the merge conflicts in the setup step. On the other hand, if you're testing to see that lazygit can warn the user about merge conflicts after an attempted merge, it's fine to wait until the run step to actually create the conflicts. If the run step is focused on the thing you're trying to test, the test will run faster and its intent will be clearer. -Use assertions to ensure that lazygit has processed all your keybindings so far. For example, if you press 'n' on a branch to create a new branch, assert that the confirmation view is now focused. +Use assertions to ensure that lazygit has processed all your keybindings so far. Each time you press a key, something should happen on the screen, so you should assert that that thing has happened. This means we won't get into trouble from keys being entered two quickly because at each stage we ensure the key has been processed. This also makes tests more readable because they help explain what we expect to be happening on-screen. For example: + +```go +input.Press(keys.Files.CommitChanges) +assert.InCommitMessagePanel() +``` If you find yourself doing something frequently in a test, consider making it a method in one of the helper arguments. For example, instead of calling `input.PressKey(keys.Universal.Confirm)` in 100 places, it's better to have a method `input.Confirm()`. This is not to say that everything should be made into a method on the input struct: just things that are particularly common in tests. +Also, given how often we need to select a menu item or type into a prompt panel, there are some helper functions for that. For example: + +```go +// asserts that a prompt opens with the title 'Enter a file name', and then types 'my file' and confirms +input.Prompt(Equals("Enter a file name"), "my file") + +// asserts that a menu opens with the title: 'Choose file content', and then selects the option which contains 'bar' +input.Menu(Equals("Choose file content"), Contains("bar")) + +// asserts a confirmation appears with the title 'Are you sure?' and the content 'Are you REALLY sure' and then confirms +input.AcceptConfirmation(Equals("Are you sure?"), Equals("Are you REALLY sure?")) +``` + ## Running tests There are three ways to invoke a test: diff --git a/pkg/integration/components/assert.go b/pkg/integration/components/assert.go index ab7d079c8..95998b759 100644 --- a/pkg/integration/components/assert.go +++ b/pkg/integration/components/assert.go @@ -21,57 +21,44 @@ func NewAssert(gui integrationTypes.GuiDriver) *Assert { return &Assert{gui: gui} } -// for making assertions on string values -type matcher struct { - testFn func(string) (bool, string) - prefix string -} - -func (self *matcher) test(value string) (bool, string) { - ok, message := self.testFn(value) - if ok { - return true, "" - } - - if self.prefix != "" { - return false, self.prefix + " " + message - } - - return false, message -} - -func (self *matcher) context(prefix string) *matcher { - self.prefix = prefix - - return self -} - func Contains(target string) *matcher { - return &matcher{testFn: func(value string) (bool, string) { - return strings.Contains(value, target), fmt.Sprintf("Expected '%s' to be found in '%s'", target, value) - }} + return NewMatcher( + fmt.Sprintf("contains '%s'", target), + func(value string) (bool, string) { + return strings.Contains(value, target), fmt.Sprintf("Expected '%s' to be found in '%s'", target, value) + }, + ) } func NotContains(target string) *matcher { - return &matcher{testFn: func(value string) (bool, string) { - return !strings.Contains(value, target), fmt.Sprintf("Expected '%s' to NOT be found in '%s'", target, value) - }} + return NewMatcher( + fmt.Sprintf("does not contain '%s'", target), + func(value string) (bool, string) { + return !strings.Contains(value, target), fmt.Sprintf("Expected '%s' to NOT be found in '%s'", target, value) + }, + ) } -func MatchesRegexp(regexStr string) *matcher { - return &matcher{testFn: func(value string) (bool, string) { - matched, err := regexp.MatchString(regexStr, value) - if err != nil { - return false, fmt.Sprintf("Unexpected error parsing regular expression '%s': %s", regexStr, err.Error()) - } - return matched, fmt.Sprintf("Expected '%s' to match regular expression '%s'", value, regexStr) - }} +func MatchesRegexp(target string) *matcher { + return NewMatcher( + fmt.Sprintf("matches regular expression '%s'", target), + func(value string) (bool, string) { + matched, err := regexp.MatchString(target, value) + if err != nil { + return false, fmt.Sprintf("Unexpected error parsing regular expression '%s': %s", target, err.Error()) + } + return matched, fmt.Sprintf("Expected '%s' to match regular expression '%s'", value, target) + }, + ) } func Equals(target string) *matcher { - return &matcher{testFn: func(value string) (bool, string) { - return target == value, fmt.Sprintf("Expected '%s' to equal '%s'", value, target) - }} + return NewMatcher( + fmt.Sprintf("equals '%s'", target), + func(value string) (bool, string) { + return target == value, fmt.Sprintf("Expected '%s' to equal '%s'", value, target) + }, + ) } func (self *Assert) WorkingTreeFileCount(expectedCount int) { @@ -186,6 +173,13 @@ func (self *Assert) InAlert() { }) } +func (self *Assert) InCommitMessagePanel() { + self.assertWithRetries(func() (bool, string) { + currentView := self.gui.CurrentContext().GetView() + return currentView.Name() == "commitMessage", "Expected commit message panel to be focused" + }) +} + func (self *Assert) InMenu() { self.assertWithRetries(func() (bool, string) { return self.gui.CurrentContext().GetView().Name() == "menu", "Expected popup menu to be focused" diff --git a/pkg/integration/components/input.go b/pkg/integration/components/input.go index adc4df261..b6f2022c6 100644 --- a/pkg/integration/components/input.go +++ b/pkg/integration/components/input.go @@ -28,87 +28,81 @@ func NewInput(gui integrationTypes.GuiDriver, keys config.KeybindingConfig, asse // key is something like 'w' or ''. It's best not to pass a direct value, // but instead to go through the default user config to get a more meaningful key name -func (self *Input) PressKeys(keyStrs ...string) { +func (self *Input) Press(keyStrs ...string) { for _, keyStr := range keyStrs { - self.pressKey(keyStr) + self.press(keyStr) } } -func (self *Input) pressKey(keyStr string) { +func (self *Input) press(keyStr string) { self.Wait(self.pushKeyDelay) self.gui.PressKey(keyStr) } func (self *Input) SwitchToStatusWindow() { - self.pressKey(self.keys.Universal.JumpToBlock[0]) + self.press(self.keys.Universal.JumpToBlock[0]) self.assert.CurrentWindowName("status") } func (self *Input) SwitchToFilesWindow() { - self.pressKey(self.keys.Universal.JumpToBlock[1]) + self.press(self.keys.Universal.JumpToBlock[1]) self.assert.CurrentWindowName("files") } func (self *Input) SwitchToBranchesWindow() { - self.pressKey(self.keys.Universal.JumpToBlock[2]) + self.press(self.keys.Universal.JumpToBlock[2]) self.assert.CurrentWindowName("localBranches") } func (self *Input) SwitchToCommitsWindow() { - self.pressKey(self.keys.Universal.JumpToBlock[3]) + self.press(self.keys.Universal.JumpToBlock[3]) self.assert.CurrentWindowName("commits") } func (self *Input) SwitchToStashWindow() { - self.pressKey(self.keys.Universal.JumpToBlock[4]) + self.press(self.keys.Universal.JumpToBlock[4]) self.assert.CurrentWindowName("stash") } func (self *Input) Type(content string) { for _, char := range content { - self.pressKey(string(char)) + self.press(string(char)) } } // i.e. pressing enter func (self *Input) Confirm() { - self.pressKey(self.keys.Universal.Confirm) -} - -func (self *Input) ProceedWhenAsked(matcher *matcher) { - self.assert.InConfirm() - self.assert.CurrentViewContent(matcher) - self.Confirm() + self.press(self.keys.Universal.Confirm) } // i.e. same as Confirm func (self *Input) Enter() { - self.pressKey(self.keys.Universal.Confirm) + self.press(self.keys.Universal.Confirm) } // i.e. pressing escape func (self *Input) Cancel() { - self.pressKey(self.keys.Universal.Return) + self.press(self.keys.Universal.Return) } // i.e. pressing space func (self *Input) PrimaryAction() { - self.pressKey(self.keys.Universal.Select) + self.press(self.keys.Universal.Select) } // i.e. pressing down arrow func (self *Input) NextItem() { - self.pressKey(self.keys.Universal.NextItem) + self.press(self.keys.Universal.NextItem) } // i.e. pressing up arrow func (self *Input) PreviousItem() { - self.pressKey(self.keys.Universal.PrevItem) + self.press(self.keys.Universal.PrevItem) } func (self *Input) ContinueMerge() { - self.PressKeys(self.keys.Universal.CreateRebaseOptionsMenu) + self.Press(self.keys.Universal.CreateRebaseOptionsMenu) self.assert.SelectedLine(Contains("continue")) self.Confirm() } @@ -141,7 +135,7 @@ func (self *Input) Log(message string) { // If this changes in future, we'll need to update this code to first attempt to find the item // in the current page and failing that, jump to the top of the view and iterate through all of it, // looking for the item. -func (self *Input) NavigateToListItemContainingText(text string) { +func (self *Input) NavigateToListItem(matcher *matcher) { self.assert.InListContext() currentContext := self.gui.CurrentContext().(types.IListContext) @@ -151,19 +145,20 @@ func (self *Input) NavigateToListItemContainingText(text string) { var matchIndex int self.assert.assertWithRetries(func() (bool, string) { - matchCount := 0 matchIndex = -1 + var matches []string // first we look for a duplicate on the current screen. We won't bother looking beyond that though. for i, line := range view.ViewBufferLines() { - if strings.Contains(line, text) { - matchCount++ + ok, _ := matcher.test(line) + if ok { + matches = append(matches, line) matchIndex = i } } - if matchCount > 1 { - return false, fmt.Sprintf("Found %d matches for %s, expected only a single match", matchCount, text) - } else if matchCount == 0 { - return false, fmt.Sprintf("Could not find item containing text: %s", text) + if len(matches) > 1 { + return false, fmt.Sprintf("Found %d matches for `%s`, expected only a single match. Lines:\n%s", len(matches), matcher.name, strings.Join(matches, "\n")) + } else if len(matches) == 0 { + return false, fmt.Sprintf("Could not find item matching: %s", matcher.name) } else { return true, "" } @@ -171,20 +166,67 @@ func (self *Input) NavigateToListItemContainingText(text string) { selectedLineIdx := view.SelectedLineIdx() if selectedLineIdx == matchIndex { - self.assert.SelectedLine(Contains(text)) + self.assert.SelectedLine(matcher) return } if selectedLineIdx < matchIndex { for i := selectedLineIdx; i < matchIndex; i++ { self.NextItem() } - self.assert.SelectedLine(Contains(text)) + self.assert.SelectedLine(matcher) return } else { for i := selectedLineIdx; i > matchIndex; i-- { self.PreviousItem() } - self.assert.SelectedLine(Contains(text)) + self.assert.SelectedLine(matcher) return } } + +func (self *Input) AcceptConfirmation(title *matcher, content *matcher) { + self.assert.InConfirm() + self.assert.CurrentViewTitle(title) + self.assert.CurrentViewContent(content) + self.Confirm() +} + +func (self *Input) DenyConfirmation(title *matcher, content *matcher) { + self.assert.InConfirm() + self.assert.CurrentViewTitle(title) + self.assert.CurrentViewContent(content) + self.Cancel() +} + +func (self *Input) Prompt(title *matcher, textToType string) { + self.assert.InPrompt() + self.assert.CurrentViewTitle(title) + self.Type(textToType) + self.Confirm() +} + +// type some text into a prompt, then switch to the suggestions panel and expect the first +// item to match the given matcher, then confirm that item. +func (self *Input) Typeahead(title *matcher, textToType string, expectedFirstOption *matcher) { + self.assert.InPrompt() + self.assert.CurrentViewTitle(title) + self.Type(textToType) + self.Press(self.keys.Universal.TogglePanel) + self.assert.CurrentViewName("suggestions") + self.assert.SelectedLine(expectedFirstOption) + self.Confirm() +} + +func (self *Input) Menu(title *matcher, optionToSelect *matcher) { + self.assert.InMenu() + self.assert.CurrentViewTitle(title) + self.NavigateToListItem(optionToSelect) + self.Confirm() +} + +func (self *Input) Alert(title *matcher, content *matcher) { + self.assert.InListContext() + self.assert.CurrentViewTitle(title) + self.assert.CurrentViewContent(content) + self.Confirm() +} diff --git a/pkg/integration/components/matcher.go b/pkg/integration/components/matcher.go new file mode 100644 index 000000000..02b10b714 --- /dev/null +++ b/pkg/integration/components/matcher.go @@ -0,0 +1,35 @@ +package components + +// for making assertions on string values +type matcher struct { + // e.g. "contains 'foo'" + name string + // returns a bool that says whether the test passed and if it returns false, it + // also returns a string of the error message + testFn func(string) (bool, string) + // this is printed when there's an error so that it's clear what the context of the assertion is + prefix string +} + +func NewMatcher(name string, testFn func(string) (bool, string)) *matcher { + return &matcher{name: name, testFn: testFn} +} + +func (self *matcher) test(value string) (bool, string) { + ok, message := self.testFn(value) + if ok { + return true, "" + } + + if self.prefix != "" { + return false, self.prefix + " " + message + } + + return false, message +} + +func (self *matcher) context(prefix string) *matcher { + self.prefix = prefix + + return self +} diff --git a/pkg/integration/components/runner.go b/pkg/integration/components/runner.go index 47677b3b9..85ea3f330 100644 --- a/pkg/integration/components/runner.go +++ b/pkg/integration/components/runner.go @@ -115,6 +115,10 @@ func prepareTestDir( } func buildLazygit() error { + // // TODO: remove this line! + // // skipping this because I'm not making changes to the app code atm. + // return nil + osCommand := oscommands.NewDummyOSCommand() return osCommand.Cmd.New(fmt.Sprintf( "go build -o %s pkg/integration/clients/injector/main.go", tempLazygitPath(), diff --git a/pkg/integration/components/test_test.go b/pkg/integration/components/test_test.go index 61466e2b4..dbab22883 100644 --- a/pkg/integration/components/test_test.go +++ b/pkg/integration/components/test_test.go @@ -64,8 +64,8 @@ func TestAssertionFailure(t *testing.T) { test := NewIntegrationTest(NewIntegrationTestArgs{ Description: unitTestDescription, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - input.PressKeys("a") - input.PressKeys("b") + input.Press("a") + input.Press("b") assert.CommitCount(2) }, }) @@ -91,8 +91,8 @@ func TestSuccess(t *testing.T) { test := NewIntegrationTest(NewIntegrationTestArgs{ Description: unitTestDescription, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - input.PressKeys("a") - input.PressKeys("b") + input.Press("a") + input.Press("b") assert.CommitCount(0) }, }) diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index 0b81bbcb3..f40b4fe39 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -20,24 +20,14 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ assert *Assert, keys config.KeybindingConfig, ) { - viewBisectOptions := func() { - input.PressKeys(keys.Commits.ViewBisectOptions) - assert.InMenu() - } markCommitAsBad := func() { - viewBisectOptions() - assert.SelectedLine(Contains("bad")) - - input.Confirm() + input.Press(keys.Commits.ViewBisectOptions) + input.Menu(Equals("Bisect"), MatchesRegexp(`mark .* as bad`)) } markCommitAsGood := func() { - viewBisectOptions() - assert.SelectedLine(Contains("bad")) - input.NextItem() - assert.SelectedLine(Contains("good")) - - input.Confirm() + input.Press(keys.Commits.ViewBisectOptions) + input.Menu(Equals("Bisect"), MatchesRegexp(`mark .* as good`)) } assert.AtLeastOneCommit() @@ -46,7 +36,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("commit 10")) - input.NavigateToListItemContainingText("commit 09") + input.NavigateToListItem(Contains("commit 09")) markCommitAsBad() @@ -55,11 +45,11 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("commits") assert.SelectedLine(Contains("<-- bad")) - input.NavigateToListItemContainingText("commit 02") + input.NavigateToListItem(Contains("commit 02")) markCommitAsGood() - // lazygit will land us in the comit between our good and bad commits. + // lazygit will land us in the commit between our good and bad commits. assert.CurrentViewName("commits") assert.SelectedLine(Contains("commit 05")) assert.SelectedLine(Contains("<-- current")) @@ -72,12 +62,8 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ markCommitAsGood() - assert.InAlert() - assert.CurrentViewContent(Contains("Bisect complete!")) // commit 5 is the culprit because we marked 4 as good and 5 as bad. - assert.CurrentViewContent(Contains("commit 05")) - assert.CurrentViewContent(Contains("Do you want to reset")) - input.Confirm() + input.Alert(Equals("Bisect complete"), MatchesRegexp("(?s)commit 05.*Do you want to reset")) assert.CurrentViewName("commits") assert.CurrentViewContent(Contains("commit 04")) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 52314518f..85829b741 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -24,20 +24,6 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ assert *Assert, keys config.KeybindingConfig, ) { - viewBisectOptions := func() { - input.PressKeys(keys.Commits.ViewBisectOptions) - assert.InMenu() - } - - markCommitAsGood := func() { - viewBisectOptions() - assert.SelectedLine(Contains("bad")) - input.NextItem() - assert.SelectedLine(Contains("good")) - - input.Confirm() - } - assert.ViewContent("information", Contains("bisecting")) assert.AtLeastOneCommit() @@ -51,13 +37,10 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("<-- current")) assert.SelectedLine(Contains("commit 07")) - markCommitAsGood() + input.Press(keys.Commits.ViewBisectOptions) + input.Menu(Equals("Bisect"), MatchesRegexp(`mark .* as good`)) - assert.InAlert() - assert.CurrentViewContent(Contains("Bisect complete!")) - assert.CurrentViewContent(Contains("commit 08")) - assert.CurrentViewContent(Contains("Do you want to reset")) - input.Confirm() + input.Alert(Equals("Bisect complete"), MatchesRegexp(`(?s)commit 08.*Do you want to reset`)) assert.ViewContent("information", NotContains("bisecting")) diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index 956a2c36b..de5c0131c 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -24,14 +24,11 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("master")) input.NextItem() assert.SelectedLine(Contains("@")) - input.PressKeys(keys.Branches.CheckoutBranchByName) - assert.InPrompt() - assert.CurrentViewTitle(Equals("Branch name:")) - input.Type("new-branch") - input.Confirm() - assert.InAlert() - assert.CurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?")) - input.Confirm() + input.Press(keys.Branches.CheckoutBranchByName) + + input.Prompt(Equals("Branch name:"), "new-branch") + + input.Alert(Equals("Branch not found"), Equals("Branch not found. Create a new branch named new-branch?")) assert.CurrentViewName("localBranches") assert.SelectedLine(Contains("new-branch")) diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 148544563..524b8e365 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -21,18 +21,15 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("localBranches") assert.SelectedLine(Contains("branch-two")) - input.PressKeys(keys.Universal.Remove) - assert.InAlert() - assert.CurrentViewContent(Contains("You cannot delete the checked out branch!")) - - input.Confirm() + input.Press(keys.Universal.Remove) + input.Alert(Equals("Error"), Contains("You cannot delete the checked out branch!")) input.NextItem() assert.SelectedLine(Contains("branch-one")) - input.PressKeys(keys.Universal.Remove) - assert.InConfirm() - assert.CurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?")) - input.Confirm() + + input.Press(keys.Universal.Remove) + input.AcceptConfirmation(Equals("Delete Branch"), Contains("Are you sure you want to delete the branch 'branch-one'?")) + assert.CurrentViewName("localBranches") assert.SelectedLine(Contains("master")) assert.CurrentViewContent(NotContains("branch-one")) diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index a398b0993..665efe7d6 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -21,30 +21,26 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("first-change-branch")) input.NextItem() assert.SelectedLine(Contains("second-change-branch")) - input.PressKeys(keys.Branches.RebaseBranch) + input.Press(keys.Branches.RebaseBranch) - assert.InConfirm() - assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) - input.Confirm() + input.AcceptConfirmation(Equals("Rebasing"), Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) - assert.InConfirm() - assert.CurrentViewContent(Contains("Conflicts!")) - input.Confirm() + input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!")) assert.CurrentViewName("files") assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke - input.PressKeys(keys.Universal.Confirm) + input.Press(keys.Universal.Confirm) assert.CurrentViewName("mergeConflicts") input.PrimaryAction() assert.ViewContent("information", Contains("rebasing")) - assert.InConfirm() - assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) - input.Confirm() + + input.AcceptConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?")) + assert.ViewContent("information", NotContains("rebasing")) // this proves we actually have integrated the changes from second-change-branch diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 2269f0292..bb5b53855 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -24,17 +24,13 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("first-change-branch")) input.NextItem() assert.SelectedLine(Contains("second-change-branch")) - input.PressKeys(keys.Branches.RebaseBranch) + input.Press(keys.Branches.RebaseBranch) - assert.InConfirm() - assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) - input.Confirm() + input.AcceptConfirmation(Equals("Rebasing"), Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) assert.ViewContent("information", Contains("rebasing")) - assert.InConfirm() - assert.CurrentViewContent(Contains("Conflicts!")) - input.Confirm() + input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!")) assert.CurrentViewName("files") assert.SelectedLine(Contains("file")) @@ -42,22 +38,22 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.SelectedLine(Contains("pick")) // this means it's a rebasing commit input.NextItem() - input.PressKeys(keys.Universal.Remove) + input.Press(keys.Universal.Remove) + // this is the commit name assert.SelectedLine(Contains("to remove")) + // the commit has been marked to drop once we continue the rebase. assert.SelectedLine(Contains("drop")) input.SwitchToFilesWindow() // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke - input.PressKeys(keys.Universal.Confirm) + input.Press(keys.Universal.Confirm) assert.CurrentViewName("mergeConflicts") input.PrimaryAction() - assert.InConfirm() - assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) - input.Confirm() + input.AcceptConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?")) assert.ViewContent("information", NotContains("rebasing")) diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index 605b7e76c..d4cadb49f 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -28,17 +28,9 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ input.NextItem() assert.SelectedLine(Contains("other-branch")) - input.PressKeys(keys.Commits.ViewResetOptions) - assert.InMenu() - assert.CurrentViewTitle(Contains("reset to other-branch")) + input.Press(keys.Commits.ViewResetOptions) - assert.SelectedLine(Contains("soft reset")) - input.NextItem() - assert.SelectedLine(Contains("mixed reset")) - input.NextItem() - assert.SelectedLine(Contains("hard reset")) - - input.Confirm() + input.Menu(Contains("reset to other-branch"), Contains("hard reset")) // ensure that we've returned from the menu before continuing assert.CurrentViewName("localBranches") diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 346c471d0..98cc3cf47 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -24,18 +24,11 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - input.PressKeys(keys.Branches.CheckoutBranchByName) - assert.CurrentViewName("confirmation") - - input.Type("branch-to") - - input.PressKeys(keys.Universal.TogglePanel) - assert.CurrentViewName("suggestions") + input.Press(keys.Branches.CheckoutBranchByName) // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in - assert.SelectedLine(Contains("branch-to-checkout")) - input.Confirm() + input.Typeahead(Equals("Branch name:"), "branch-to", Contains("branch-to-checkout")) assert.CurrentBranchName("branch-to-checkout") }, diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 7cbf6a70a..444cf35e4 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -35,23 +35,21 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("subCommits") assert.SelectedLine(Contains("four")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() assert.SelectedLine(Contains("three")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.SelectedLine(Contains("two")) - input.PressKeys(keys.Commits.PasteCommits) - assert.InAlert() - assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + input.Press(keys.Commits.PasteCommits) + input.Alert(Equals("Cherry-Pick"), Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) - input.Confirm() assert.CurrentViewName("commits") assert.SelectedLine(Contains("four")) input.NextItem() @@ -60,7 +58,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("two")) assert.ViewContent("information", Contains("2 commits copied")) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index 99005ad8e..377e21e76 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -26,42 +26,36 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("subCommits") assert.SelectedLine(Contains("second-change-branch unrelated change")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() assert.SelectedLine(Contains("second change")) - input.PressKeys(keys.Commits.CherryPickCopy) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.SelectedLine(Contains("first change")) - input.PressKeys(keys.Commits.PasteCommits) - assert.InAlert() - assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + input.Press(keys.Commits.PasteCommits) + input.Alert(Equals("Cherry-Pick"), Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) - input.Confirm() - - assert.CurrentViewContent(Contains("Conflicts!")) - input.Confirm() + input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!")) assert.CurrentViewName("files") assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke - input.PressKeys(keys.Universal.Confirm) + input.Press(keys.Universal.Confirm) assert.CurrentViewName("mergeConflicts") // picking 'Second change' input.NextItem() input.PrimaryAction() - assert.InConfirm() - assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) - input.Confirm() + input.AcceptConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?")) assert.CurrentViewName("files") assert.WorkingTreeFileCount(0) @@ -81,7 +75,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("first change")) assert.ViewContent("information", Contains("2 commits copied")) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index 1b7c42793..a20b0df34 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -20,8 +20,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ input.PrimaryAction() input.NextItem() input.PrimaryAction() - input.PressKeys(keys.Files.CommitChanges) + input.Press(keys.Files.CommitChanges) + assert.InCommitMessagePanel() commitMessage := "my commit message" input.Type(commitMessage) input.Confirm() diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index 15f26d15d..51e060ec3 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -17,11 +17,12 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(0) input.PrimaryAction() - input.PressKeys(keys.Files.CommitChanges) + input.Press(keys.Files.CommitChanges) + assert.InCommitMessagePanel() input.Type("first line") - input.PressKeys(keys.Universal.AppendNewline) - input.PressKeys(keys.Universal.AppendNewline) + input.Press(keys.Universal.AppendNewline) + input.Press(keys.Universal.AppendNewline) input.Type("third line") input.Confirm() diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go index 6cf77e89f..3557acbcf 100644 --- a/pkg/integration/tests/commit/new_branch.go +++ b/pkg/integration/tests/commit/new_branch.go @@ -23,13 +23,10 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("commits") input.NextItem() - input.PressKeys(keys.Universal.New) - - assert.CurrentViewName("confirmation") + input.Press(keys.Universal.New) branchName := "my-branch-name" - input.Type(branchName) - input.Confirm() + input.Prompt(Contains("New Branch Name"), branchName) assert.CommitCount(2) assert.HeadCommitMessage(Contains("commit 2")) diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go index c0fccbb60..448501763 100644 --- a/pkg/integration/tests/commit/revert.go +++ b/pkg/integration/tests/commit/revert.go @@ -20,18 +20,13 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() - input.PressKeys(keys.Commits.RevertCommit) - assert.InConfirm() - assert.CurrentViewTitle(Equals("Revert commit")) - assert.CurrentViewContent(MatchesRegexp("Are you sure you want to revert \\w+?")) - input.Confirm() + input.Press(keys.Commits.RevertCommit) + input.AcceptConfirmation(Equals("Revert commit"), MatchesRegexp(`Are you sure you want to revert \w+?`)) assert.CommitCount(2) assert.HeadCommitMessage(Contains("Revert \"first commit\"")) input.PreviousItem() assert.MainViewContent(Contains("-myfile content")) assert.FileSystemPathNotPresent("myfile") - - input.Wait(10) }, }) diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index 2ed52d011..acce2c76a 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -18,11 +18,28 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) + assert.CurrentViewName("files") + assert.SelectedLine(Contains("myfile")) + // stage the file input.PrimaryAction() - input.Confirm() - input.PrimaryAction() - input.PressKeys(keys.Files.CommitChanges) + input.Enter() + assert.CurrentViewName("stagingSecondary") + // we start with both lines having been staged + assert.ViewContent("stagingSecondary", Contains("+myfile content")) + assert.ViewContent("stagingSecondary", Contains("+with a second line")) + assert.ViewContent("staging", NotContains("+myfile content")) + assert.ViewContent("staging", NotContains("+with a second line")) + // unstage the selected line + input.PrimaryAction() + + // the line should have been moved to the main view + assert.ViewContent("stagingSecondary", NotContains("+myfile content")) + assert.ViewContent("stagingSecondary", Contains("+with a second line")) + assert.ViewContent("staging", Contains("+myfile content")) + assert.ViewContent("staging", NotContains("+with a second line")) + + input.Press(keys.Files.CommitChanges) commitMessage := "my commit message" input.Type(commitMessage) input.Confirm() @@ -30,5 +47,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(1) assert.HeadCommitMessage(Equals(commitMessage)) assert.CurrentWindowName("stagingSecondary") + + // TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed) }, }) diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go index 5d8e400b9..bb0cba3c5 100644 --- a/pkg/integration/tests/commit/staged_without_hooks.go +++ b/pkg/integration/tests/commit/staged_without_hooks.go @@ -18,17 +18,38 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) + // stage the file + assert.CurrentViewName("files") + assert.SelectedLine(Contains("myfile")) input.PrimaryAction() - input.Confirm() - input.PrimaryAction() - input.PressKeys(keys.Files.CommitChangesWithoutHook) + input.Enter() + assert.CurrentViewName("stagingSecondary") + // we start with both lines having been staged + assert.ViewContent("stagingSecondary", Contains("+myfile content")) + assert.ViewContent("stagingSecondary", Contains("+with a second line")) + assert.ViewContent("staging", NotContains("+myfile content")) + assert.ViewContent("staging", NotContains("+with a second line")) - commitMessage := "my commit message" + // unstage the selected line + input.PrimaryAction() + + // the line should have been moved to the main view + assert.ViewContent("stagingSecondary", NotContains("+myfile content")) + assert.ViewContent("stagingSecondary", Contains("+with a second line")) + assert.ViewContent("staging", Contains("+myfile content")) + assert.ViewContent("staging", NotContains("+with a second line")) + + input.Press(keys.Files.CommitChangesWithoutHook) + assert.InCommitMessagePanel() + assert.CurrentViewContent(Contains("WIP")) + commitMessage := ": my commit message" input.Type(commitMessage) input.Confirm() assert.CommitCount(1) assert.HeadCommitMessage(Equals("WIP" + commitMessage)) - assert.CurrentWindowName("stagingSecondary") + assert.CurrentViewName("stagingSecondary") + + // TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed) }, }) diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index 50700fd4e..92be9615b 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -5,6 +5,8 @@ import ( . "github.com/jesseduffield/lazygit/pkg/integration/components" ) +// TODO: find out why we can't use assert.SelectedLine() on the staging/stagingSecondary views. + var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing", ExtraCmdArgs: "", @@ -18,10 +20,18 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) - input.Confirm() + assert.CurrentViewName("files") + assert.SelectedLine(Contains("myfile")) + input.Enter() + assert.CurrentViewName("staging") + assert.ViewContent("stagingSecondary", NotContains("+myfile content")) + // stage the first line input.PrimaryAction() - input.PressKeys(keys.Files.CommitChanges) + assert.ViewContent("staging", NotContains("+myfile content")) + assert.ViewContent("stagingSecondary", Contains("+myfile content")) + input.Press(keys.Files.CommitChanges) + assert.InCommitMessagePanel() commitMessage := "my commit message" input.Type(commitMessage) input.Confirm() @@ -29,5 +39,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(1) assert.HeadCommitMessage(Equals(commitMessage)) assert.CurrentWindowName("staging") + + // TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed) }, }) diff --git a/pkg/integration/tests/commit/unstaged_without_hooks.go b/pkg/integration/tests/commit/unstaged_without_hooks.go deleted file mode 100644 index e2b5123a5..000000000 --- a/pkg/integration/tests/commit/unstaged_without_hooks.go +++ /dev/null @@ -1,33 +0,0 @@ -package commit - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var UnstagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing without pre-commit hooks", - ExtraCmdArgs: "", - Skip: false, - SetupConfig: func(config *config.AppConfig) {}, - SetupRepo: func(shell *Shell) { - shell. - CreateFile("myfile", "myfile content\nwith a second line"). - CreateFile("myfile2", "myfile2 content") - }, - Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - assert.CommitCount(0) - - input.Confirm() - input.PrimaryAction() - input.PressKeys(keys.Files.CommitChangesWithoutHook) - - commitMessage := "my commit message" - input.Type(commitMessage) - input.Confirm() - - assert.CommitCount(1) - assert.HeadCommitMessage(Equals("WIP" + commitMessage)) - assert.CurrentWindowName("staging") - }, -}) diff --git a/pkg/integration/tests/custom_commands/basic.go b/pkg/integration/tests/custom_commands/basic.go index 13dffb513..a97bdef4a 100644 --- a/pkg/integration/tests/custom_commands/basic.go +++ b/pkg/integration/tests/custom_commands/basic.go @@ -29,7 +29,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ ) { assert.WorkingTreeFileCount(0) - input.PressKeys("a") + input.Press("a") assert.WorkingTreeFileCount(1) assert.SelectedLine(Contains("myfile")) }, diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go index 34970c21b..e0502fbae 100644 --- a/pkg/integration/tests/custom_commands/form_prompts.go +++ b/pkg/integration/tests/custom_commands/form_prompts.go @@ -63,23 +63,13 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ ) { assert.WorkingTreeFileCount(0) - input.PressKeys("a") + input.Press("a") - assert.InPrompt() - assert.CurrentViewTitle(Equals("Enter a file name")) - input.Type("my file") - input.Confirm() + input.Prompt(Equals("Enter a file name"), "my file") - assert.InMenu() - assert.CurrentViewTitle(Equals("Choose file content")) - assert.SelectedLine(Contains("foo")) - input.NextItem() - assert.SelectedLine(Contains("bar")) - input.Confirm() + input.Menu(Equals("Choose file content"), Contains("bar")) - assert.InConfirm() - assert.CurrentViewTitle(Equals("Are you sure?")) - input.Confirm() + input.AcceptConfirmation(Equals("Are you sure?"), Equals("Are you REALLY sure you want to make this file? Up to you buddy.")) assert.WorkingTreeFileCount(1) assert.SelectedLine(Contains("my file")) diff --git a/pkg/integration/tests/custom_commands/menu_from_command.go b/pkg/integration/tests/custom_commands/menu_from_command.go index dd5d8324a..5d8fee71a 100644 --- a/pkg/integration/tests/custom_commands/menu_from_command.go +++ b/pkg/integration/tests/custom_commands/menu_from_command.go @@ -51,19 +51,11 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{ assert.WorkingTreeFileCount(0) input.SwitchToBranchesWindow() - input.PressKeys("a") + input.Press("a") - assert.InMenu() - assert.CurrentViewTitle(Equals("Choose commit message")) - assert.SelectedLine(Equals("baz")) - input.NextItem() - assert.SelectedLine(Equals("bar")) - input.Confirm() + input.Menu(Equals("Choose commit message"), Contains("bar")) - assert.InPrompt() - assert.CurrentViewTitle(Equals("Description")) - input.Type(" my branch") - input.Confirm() + input.Prompt(Equals("Description"), " my branch") input.SwitchToFilesWindow() diff --git a/pkg/integration/tests/custom_commands/menu_from_commands_output.go b/pkg/integration/tests/custom_commands/menu_from_commands_output.go index 8224f507b..1a7860ebb 100644 --- a/pkg/integration/tests/custom_commands/menu_from_commands_output.go +++ b/pkg/integration/tests/custom_commands/menu_from_commands_output.go @@ -47,22 +47,19 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ assert *Assert, keys config.KeybindingConfig, ) { + assert.CurrentBranchName("feature/bar") + assert.WorkingTreeFileCount(0) input.SwitchToBranchesWindow() - input.PressKeys("a") + input.Press("a") assert.InPrompt() assert.CurrentViewTitle(Equals("Which git command do you want to run?")) assert.SelectedLine(Equals("branch")) input.Confirm() - assert.InMenu() - assert.CurrentViewTitle(Equals("Branch:")) - input.NextItem() - input.NextItem() - assert.SelectedLine(Equals("master")) - input.Confirm() + input.Menu(Equals("Branch:"), Equals("master")) assert.CurrentBranchName("master") }, diff --git a/pkg/integration/tests/custom_commands/multiple_prompts.go b/pkg/integration/tests/custom_commands/multiple_prompts.go index 4b520933e..5e6ebb6a2 100644 --- a/pkg/integration/tests/custom_commands/multiple_prompts.go +++ b/pkg/integration/tests/custom_commands/multiple_prompts.go @@ -61,23 +61,13 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{ ) { assert.WorkingTreeFileCount(0) - input.PressKeys("a") + input.Press("a") - assert.InPrompt() - assert.CurrentViewTitle(Equals("Enter a file name")) - input.Type("myfile") - input.Confirm() + input.Prompt(Equals("Enter a file name"), "myfile") - assert.InMenu() - assert.CurrentViewTitle(Equals("Choose file content")) - assert.SelectedLine(Contains("foo")) - input.NextItem() - assert.SelectedLine(Contains("bar")) - input.Confirm() + input.Menu(Equals("Choose file content"), Contains("bar")) - assert.InConfirm() - assert.CurrentViewTitle(Equals("Are you sure?")) - input.Confirm() + input.AcceptConfirmation(Equals("Are you sure?"), Equals("Are you REALLY sure you want to make this file? Up to you buddy.")) assert.WorkingTreeFileCount(1) assert.SelectedLine(Contains("myfile")) diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go index bbb93335d..3e87c934b 100644 --- a/pkg/integration/tests/diff/diff.go +++ b/pkg/integration/tests/diff/diff.go @@ -26,11 +26,8 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("localBranches") assert.SelectedLine(Contains("branch-a")) - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - assert.CurrentViewTitle(Equals("Diffing")) - assert.SelectedLine(Contains("diff branch-a")) - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + input.Menu(Equals("Diffing"), Contains(`diff branch-a`)) assert.CurrentViewName("localBranches") @@ -48,14 +45,12 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("file1")) assert.MainViewContent(Contains("+second line")) - input.PressKeys(keys.Universal.Return) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) + input.Press(keys.Universal.Return) assert.CurrentViewName("localBranches") - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - input.NavigateToListItemContainingText("reverse diff direction") - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + input.Menu(Equals("Diffing"), Contains("reverse diff direction")) assert.ViewContent("information", Contains("showing output for: git diff branch-a branch-b -R")) assert.MainViewContent(Contains("-second line")) }, diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go index 5efd795e2..a965fffd5 100644 --- a/pkg/integration/tests/diff/diff_and_apply_patch.go +++ b/pkg/integration/tests/diff/diff_and_apply_patch.go @@ -26,11 +26,9 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("localBranches") assert.SelectedLine(Contains("branch-a")) - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - assert.CurrentViewTitle(Equals("Diffing")) - assert.SelectedLine(Contains("diff branch-a")) - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + + input.Menu(Equals("Diffing"), Equals("diff branch-a")) assert.CurrentViewName("localBranches") @@ -51,20 +49,14 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ // add the file to the patch input.PrimaryAction() - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - assert.CurrentViewTitle(Equals("Diffing")) - input.NavigateToListItemContainingText("exit diff mode") - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + input.Menu(Equals("Diffing"), Contains("exit diff mode")) assert.ViewContent("information", NotContains("building patch")) - input.PressKeys(keys.Universal.CreatePatchOptionsMenu) - assert.InMenu() - assert.CurrentViewTitle(Equals("Patch Options")) - // including the keybinding 'a' here to distinguish the menu item from the 'apply patch in reverse' item - input.NavigateToListItemContainingText("a apply patch") - input.Confirm() + input.Press(keys.Universal.CreatePatchOptionsMenu) + // adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item + input.Menu(Equals("Patch Options"), MatchesRegexp("apply patch$")) input.SwitchToFilesWindow() diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go index 7425d7592..2a2802ec8 100644 --- a/pkg/integration/tests/diff/diff_commits.go +++ b/pkg/integration/tests/diff/diff_commits.go @@ -24,11 +24,9 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Contains("third commit")) - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - assert.CurrentViewTitle(Equals("Diffing")) - assert.SelectedLine(Contains("diff")) - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + input.Menu(Equals("Diffing"), MatchesRegexp(`diff \w+`)) + assert.NotInPopup() assert.ViewContent("information", Contains("showing output for: git diff")) @@ -40,10 +38,9 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ assert.MainViewContent(Contains("-second line\n-third line")) - input.PressKeys(keys.Universal.DiffingMenu) - assert.InMenu() - input.NavigateToListItemContainingText("reverse diff direction") - input.Confirm() + input.Press(keys.Universal.DiffingMenu) + input.Menu(Equals("Diffing"), Contains("reverse diff direction")) + assert.NotInPopup() assert.MainViewContent(Contains("+second line\n+third line")) diff --git a/pkg/integration/tests/file/discard_changes.go b/pkg/integration/tests/file/discard_changes.go index ad931a26b..87e39e96b 100644 --- a/pkg/integration/tests/file/discard_changes.go +++ b/pkg/integration/tests/file/discard_changes.go @@ -75,47 +75,47 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(3) type statusFile struct { - status string - path string + status string + label string + menuTitle string } discardOneByOne := func(files []statusFile) { for _, file := range files { - assert.SelectedLine(Contains(file.status + " " + file.path)) - input.PressKeys(keys.Universal.Remove) - assert.InMenu() - assert.CurrentViewContent(Contains("discard all changes")) - input.Confirm() + assert.SelectedLine(Contains(file.status + " " + file.label)) + input.Press(keys.Universal.Remove) + input.Menu(Equals(file.menuTitle), Contains("discard all changes")) } } discardOneByOne([]statusFile{ - {"UA", "added-them-changed-us.txt"}, - {"AA", "both-added.txt"}, - {"DD", "both-deleted.txt"}, - {"UU", "both-modded.txt"}, - {"AU", "changed-them-added-us.txt"}, - {"UD", "deleted-them.txt"}, - {"DU", "deleted-us.txt"}, + {status: "UA", label: "added-them-changed-us.txt", menuTitle: "added-them-changed-us.txt"}, + {status: "AA", label: "both-added.txt", menuTitle: "both-added.txt"}, + {status: "DD", label: "both-deleted.txt", menuTitle: "both-deleted.txt"}, + {status: "UU", label: "both-modded.txt", menuTitle: "both-modded.txt"}, + {status: "AU", label: "changed-them-added-us.txt", menuTitle: "changed-them-added-us.txt"}, + {status: "UD", label: "deleted-them.txt", menuTitle: "deleted-them.txt"}, + {status: "DU", label: "deleted-us.txt", menuTitle: "deleted-us.txt"}, }) assert.InConfirm() assert.CurrentViewTitle(Contains("continue")) assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) - input.PressKeys(keys.Universal.Return) + input.Press(keys.Universal.Return) discardOneByOne([]statusFile{ - {"MD", "change-delete.txt"}, - {"D ", "delete-change.txt"}, - {"D ", "deleted-staged.txt"}, - {" D", "deleted.txt"}, - {"MM", "double-modded.txt"}, - {"M ", "modded-staged.txt"}, - {" M", "modded.txt"}, - {"R ", "renamed.txt → renamed2.txt"}, - {"AM", "added-changed.txt"}, - {"A ", "new-staged.txt"}, - {"??", "new.txt"}, + {status: "MD", label: "change-delete.txt", menuTitle: "change-delete.txt"}, + {status: "D ", label: "delete-change.txt", menuTitle: "delete-change.txt"}, + {status: "D ", label: "deleted-staged.txt", menuTitle: "deleted-staged.txt"}, + {status: " D", label: "deleted.txt", menuTitle: "deleted.txt"}, + {status: "MM", label: "double-modded.txt", menuTitle: "double-modded.txt"}, + {status: "M ", label: "modded-staged.txt", menuTitle: "modded-staged.txt"}, + {status: " M", label: "modded.txt", menuTitle: "modded.txt"}, + // the menu title only includes the new file + {status: "R ", label: "renamed.txt → renamed2.txt", menuTitle: "renamed2.txt"}, + {status: "AM", label: "added-changed.txt", menuTitle: "added-changed.txt"}, + {status: "A ", label: "new-staged.txt", menuTitle: "new-staged.txt"}, + {status: "??", label: "new.txt", menuTitle: "new.txt"}, }) assert.WorkingTreeFileCount(0) diff --git a/pkg/integration/tests/interactive_rebase/amend_merge.go b/pkg/integration/tests/interactive_rebase/amend_merge.go index c71bb1c9d..92f9f26a6 100644 --- a/pkg/integration/tests/interactive_rebase/amend_merge.go +++ b/pkg/integration/tests/interactive_rebase/amend_merge.go @@ -36,8 +36,8 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ mergeCommitMessage := "Merge branch 'feature-branch' into development-branch" assert.HeadCommitMessage(Contains(mergeCommitMessage)) - input.PressKeys(keys.Commits.AmendToCommit) - input.ProceedWhenAsked(Contains("Are you sure you want to amend this commit with your staged files?")) + input.Press(keys.Commits.AmendToCommit) + input.AcceptConfirmation(Equals("Amend Commit"), Contains("Are you sure you want to amend this commit with your staged files?")) // assuring we haven't added a brand new commit assert.CommitCount(3) diff --git a/pkg/integration/tests/interactive_rebase/one.go b/pkg/integration/tests/interactive_rebase/one.go index 4a8e697d9..d516087ff 100644 --- a/pkg/integration/tests/interactive_rebase/one.go +++ b/pkg/integration/tests/interactive_rebase/one.go @@ -18,20 +18,20 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - input.NavigateToListItemContainingText("commit 02") - input.PressKeys(keys.Universal.Edit) + input.NavigateToListItem(Contains("commit 02")) + input.Press(keys.Universal.Edit) assert.SelectedLine(Contains("YOU ARE HERE")) input.PreviousItem() - input.PressKeys(keys.Commits.MarkCommitAsFixup) + input.Press(keys.Commits.MarkCommitAsFixup) assert.SelectedLine(Contains("fixup")) input.PreviousItem() - input.PressKeys(keys.Universal.Remove) + input.Press(keys.Universal.Remove) assert.SelectedLine(Contains("drop")) input.PreviousItem() - input.PressKeys(keys.Commits.SquashDown) + input.Press(keys.Commits.SquashDown) assert.SelectedLine(Contains("squash")) input.ContinueRebase() diff --git a/pkg/integration/tests/misc/confirm_on_quit.go b/pkg/integration/tests/misc/confirm_on_quit.go index 134c2cab5..183f7dd0b 100644 --- a/pkg/integration/tests/misc/confirm_on_quit.go +++ b/pkg/integration/tests/misc/confirm_on_quit.go @@ -11,15 +11,12 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ Skip: false, SetupConfig: func(config *config.AppConfig) { config.UserConfig.ConfirmOnQuit = true - config.UserConfig.Gui.Theme.ActiveBorderColor = []string{"red"} }, SetupRepo: func(shell *Shell) {}, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) - input.PressKeys(keys.Universal.Quit) - assert.InConfirm() - assert.CurrentViewContent(Contains("Are you sure you want to quit?")) - input.Confirm() + input.Press(keys.Universal.Quit) + input.AcceptConfirmation(Equals(""), Contains("Are you sure you want to quit?")) }, }) diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go index 3589c5a76..c325822e6 100644 --- a/pkg/integration/tests/stash/rename.go +++ b/pkg/integration/tests/stash/rename.go @@ -25,12 +25,9 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ assert.SelectedLine(Equals("On master: bar")) input.NextItem() assert.SelectedLine(Equals("On master: foo")) - input.PressKeys(keys.Stash.RenameStash) - assert.InPrompt() - assert.CurrentViewTitle(Equals("Rename stash: stash@{1}")) + input.Press(keys.Stash.RenameStash) - input.Type(" baz") - input.Confirm() + input.Prompt(Equals("Rename stash: stash@{1}"), " baz") assert.SelectedLine(Equals("On master: foo baz")) }, diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index 766469a70..23ff7e99d 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -19,15 +19,12 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ assert.StashCount(0) assert.WorkingTreeFileCount(1) - input.PressKeys(keys.Files.ViewStashOptions) - assert.InMenu() + input.Press(keys.Files.ViewStashOptions) - input.PressKeys("a") - assert.InPrompt() - assert.CurrentViewTitle(Equals("Stash changes")) + input.Menu(Equals("Stash options"), MatchesRegexp("stash all changes$")) + + input.Prompt(Equals("Stash changes"), "my stashed file") - 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 998910f40..d193600df 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -20,15 +20,12 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ assert.StashCount(0) assert.WorkingTreeFileCount(2) - input.PressKeys(keys.Files.ViewStashOptions) - assert.InMenu() + input.Press(keys.Files.ViewStashOptions) - input.PressKeys("U") - assert.InPrompt() - assert.CurrentViewTitle(Equals("Stash changes")) + input.Menu(Equals("Stash options"), Contains("stash all changes including untracked files")) + + input.Prompt(Equals("Stash changes"), "my stashed file") - input.Type("my stashed file") - input.Confirm() assert.StashCount(1) assert.WorkingTreeFileCount(0) }, diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index 6f7476657..d63b1aa50 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -45,7 +45,6 @@ var tests = []*components.IntegrationTest{ commit.Staged, commit.Unstaged, commit.StagedWithoutHooks, - commit.UnstagedWithoutHooks, custom_commands.Basic, custom_commands.FormPrompts, custom_commands.MenuFromCommand,