diff --git a/pkg/integration/tests/submodule/remove.go b/pkg/integration/tests/submodule/remove.go new file mode 100644 index 000000000..0a8884e15 --- /dev/null +++ b/pkg/integration/tests/submodule/remove.go @@ -0,0 +1,46 @@ +package submodule + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var Remove = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Remove a submodule", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("first commit") + shell.RunCommand("git clone --bare . ../other_repo") + shell.RunCommand("git submodule add ../other_repo my_submodule") + shell.GitAddAll() + shell.Commit("add submodule") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Submodules().Focus(). + Lines( + Contains("my_submodule").IsSelected(), + ). + Press(keys.Universal.Remove). + Tap(func() { + t.ExpectPopup().Confirmation(). + Title(Equals("Remove submodule")). + Content(Equals("Are you sure you want to remove submodule 'my_submodule' and its corresponding directory? This is irreversible.")). + Confirm() + }). + IsEmpty() + + t.Views().Files().Focus(). + Lines( + MatchesRegexp(`M.*\.gitmodules`).IsSelected(), + MatchesRegexp(`D.*my_submodule`), + ) + + t.Views().Main().Content( + Contains("-[submodule \"my_submodule\"]"). + Contains("- path = my_submodule"). + Contains("- url = ../other_repo"), + ) + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index d04bb7869..79bb5a84c 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -77,6 +77,7 @@ var tests = []*components.IntegrationTest{ filter_by_path.TypeFile, patch_building.BuildPatchAndCopyToClipboard, submodule.Add, + submodule.Remove, } func GetTests() []*components.IntegrationTest { diff --git a/test/integration/submoduleRemove/expected/other_repo/HEAD b/test/integration/submoduleRemove/expected/other_repo/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/submoduleRemove/expected/other_repo/config b/test/integration/submoduleRemove/expected/other_repo/config deleted file mode 100644 index e710ce53e..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/config +++ /dev/null @@ -1,8 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = true - ignorecase = true - precomposeunicode = true -[remote "origin"] - url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleRemove/actual/./repo diff --git a/test/integration/submoduleRemove/expected/other_repo/description b/test/integration/submoduleRemove/expected/other_repo/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/submoduleRemove/expected/other_repo/info/exclude b/test/integration/submoduleRemove/expected/other_repo/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/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/submoduleRemove/expected/other_repo/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/submoduleRemove/expected/other_repo/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 deleted file mode 100644 index 7f2ebf4ee..000000000 Binary files a/test/integration/submoduleRemove/expected/other_repo/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/other_repo/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/submoduleRemove/expected/other_repo/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 deleted file mode 100644 index f74bf2335..000000000 Binary files a/test/integration/submoduleRemove/expected/other_repo/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/other_repo/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e b/test/integration/submoduleRemove/expected/other_repo/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e deleted file mode 100644 index 64d20cb1e..000000000 Binary files a/test/integration/submoduleRemove/expected/other_repo/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/other_repo/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 b/test/integration/submoduleRemove/expected/other_repo/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 deleted file mode 100644 index 5dd5f3236..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 +++ /dev/null @@ -1,2 +0,0 @@ -xM -0@sJ&N  I޾/ZHR%d"r@X<-4dG5?fxN(_& 6]פ˟\ճ5, \ No newline at end of file diff --git a/test/integration/submoduleRemove/expected/other_repo/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/submoduleRemove/expected/other_repo/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5f..000000000 Binary files a/test/integration/submoduleRemove/expected/other_repo/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/other_repo/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/submoduleRemove/expected/other_repo/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 deleted file mode 100644 index 96d2e71a6..000000000 Binary files a/test/integration/submoduleRemove/expected/other_repo/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/other_repo/packed-refs b/test/integration/submoduleRemove/expected/other_repo/packed-refs deleted file mode 100644 index 62f6568b2..000000000 --- a/test/integration/submoduleRemove/expected/other_repo/packed-refs +++ /dev/null @@ -1,2 +0,0 @@ -# pack-refs with: peeled fully-peeled sorted -42530e986dbb65877ed8d61ca0c816e425e5c62e refs/heads/master diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/submoduleRemove/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 5b256d7d3..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -remove submodule diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/FETCH_HEAD b/test/integration/submoduleRemove/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/HEAD b/test/integration/submoduleRemove/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/config b/test/integration/submoduleRemove/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/submoduleRemove/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/submoduleRemove/expected/repo/.git_keep/description b/test/integration/submoduleRemove/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/submoduleRemove/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/submoduleRemove/expected/repo/.git_keep/index b/test/integration/submoduleRemove/expected/repo/.git_keep/index deleted file mode 100644 index 93d0089f1..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/info/exclude b/test/integration/submoduleRemove/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/submoduleRemove/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/submoduleRemove/expected/repo/.git_keep/logs/HEAD b/test/integration/submoduleRemove/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 34e702d94..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI 1534792759 +0100 commit (initial): myfile1 -a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI 1534792759 +0100 commit: myfile2 -42530e986dbb65877ed8d61ca0c816e425e5c62e 9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 CI 1534792759 +0100 commit: add submodule -9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 611cac756ef1944ab56d12f4ea3ae4623724c8cf CI 1648348134 +1100 commit: remove submodule diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/submoduleRemove/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 34e702d94..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,4 +0,0 @@ -0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI 1534792759 +0100 commit (initial): myfile1 -a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI 1534792759 +0100 commit: myfile2 -42530e986dbb65877ed8d61ca0c816e425e5c62e 9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 CI 1534792759 +0100 commit: add submodule -9d10a5a0a21eb2cfdb6206f474ed57fd5cd51440 611cac756ef1944ab56d12f4ea3ae4623724c8cf CI 1648348134 +1100 commit: remove submodule diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 deleted file mode 100644 index 7f2ebf4ee..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 deleted file mode 100644 index f74bf2335..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2b/864257bf2d49adbad8785540d85030a60852ff b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2b/864257bf2d49adbad8785540d85030a60852ff deleted file mode 100644 index 5bfb0cefc..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2b/864257bf2d49adbad8785540d85030a60852ff and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2e/eb2c1e6451d1318b506eecddf936b59a5f32b8 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2e/eb2c1e6451d1318b506eecddf936b59a5f32b8 deleted file mode 100644 index acdda888b..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/2e/eb2c1e6451d1318b506eecddf936b59a5f32b8 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e deleted file mode 100644 index 64d20cb1e..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/42/530e986dbb65877ed8d61ca0c816e425e5c62e and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/61/1cac756ef1944ab56d12f4ea3ae4623724c8cf b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/61/1cac756ef1944ab56d12f4ea3ae4623724c8cf deleted file mode 100644 index 6c2492dc7..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/61/1cac756ef1944ab56d12f4ea3ae4623724c8cf and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/9d/10a5a0a21eb2cfdb6206f474ed57fd5cd51440 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/9d/10a5a0a21eb2cfdb6206f474ed57fd5cd51440 deleted file mode 100644 index d63e62eec..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/9d/10a5a0a21eb2cfdb6206f474ed57fd5cd51440 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 deleted file mode 100644 index 5dd5f3236..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/0a5125768001a3ea263ffb7cafbc421a508153 +++ /dev/null @@ -1,2 +0,0 @@ -xM -0@sJ&N  I޾/ZHR%d"r@X<-4dG5?fxN(_& 6]פ˟\ճ5, \ No newline at end of file diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5f..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 deleted file mode 100644 index 96d2e71a6..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 deleted file mode 100644 index 711223894..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/f1/43043bb53b17b5727a43b6cfbb1a8d1f5a222d b/test/integration/submoduleRemove/expected/repo/.git_keep/objects/f1/43043bb53b17b5727a43b6cfbb1a8d1f5a222d deleted file mode 100644 index 8673162cc..000000000 Binary files a/test/integration/submoduleRemove/expected/repo/.git_keep/objects/f1/43043bb53b17b5727a43b6cfbb1a8d1f5a222d and /dev/null differ diff --git a/test/integration/submoduleRemove/expected/repo/.git_keep/refs/heads/master b/test/integration/submoduleRemove/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 6c6578e0b..000000000 --- a/test/integration/submoduleRemove/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -611cac756ef1944ab56d12f4ea3ae4623724c8cf diff --git a/test/integration/submoduleRemove/expected/repo/.gitmodules_keep b/test/integration/submoduleRemove/expected/repo/.gitmodules_keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/submoduleRemove/expected/repo/myfile1 b/test/integration/submoduleRemove/expected/repo/myfile1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/submoduleRemove/expected/repo/myfile1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/submoduleRemove/expected/repo/myfile2 b/test/integration/submoduleRemove/expected/repo/myfile2 deleted file mode 100644 index 180cf8328..000000000 --- a/test/integration/submoduleRemove/expected/repo/myfile2 +++ /dev/null @@ -1 +0,0 @@ -test2 diff --git a/test/integration/submoduleRemove/recording.json b/test/integration/submoduleRemove/recording.json deleted file mode 100644 index ad22a348d..000000000 --- a/test/integration/submoduleRemove/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":912,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1280,"Mod":0,"Key":256,"Ch":100},{"Timestamp":1696,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2544,"Mod":0,"Key":256,"Ch":91},{"Timestamp":2984,"Mod":0,"Key":256,"Ch":99},{"Timestamp":3680,"Mod":0,"Key":256,"Ch":114},{"Timestamp":3736,"Mod":0,"Key":256,"Ch":101},{"Timestamp":3824,"Mod":0,"Key":256,"Ch":109},{"Timestamp":3872,"Mod":0,"Key":256,"Ch":111},{"Timestamp":3944,"Mod":0,"Key":256,"Ch":118},{"Timestamp":3976,"Mod":0,"Key":256,"Ch":101},{"Timestamp":4064,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4152,"Mod":0,"Key":256,"Ch":115},{"Timestamp":4248,"Mod":0,"Key":256,"Ch":117},{"Timestamp":4320,"Mod":0,"Key":256,"Ch":98},{"Timestamp":4560,"Mod":0,"Key":256,"Ch":109},{"Timestamp":4632,"Mod":0,"Key":256,"Ch":111},{"Timestamp":4720,"Mod":0,"Key":256,"Ch":100},{"Timestamp":4824,"Mod":0,"Key":256,"Ch":117},{"Timestamp":4880,"Mod":0,"Key":256,"Ch":108},{"Timestamp":4944,"Mod":0,"Key":256,"Ch":101},{"Timestamp":5152,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5648,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/submoduleRemove/setup.sh b/test/integration/submoduleRemove/setup.sh deleted file mode 100644 index cd5b3ce64..000000000 --- a/test/integration/submoduleRemove/setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -export GIT_COMMITTER_DATE="Mon 20 Aug 2018 20:19:19 BST" -export GIT_AUTHOR_DATE="Mon 20 Aug 2018 20:19:19 BST" - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test1 > myfile1 -git add . -git commit -am "myfile1" -echo test2 > myfile2 -git add . -git commit -am "myfile2" - -cd .. -git clone --bare ./repo other_repo -cd repo - -git -c protocol.file.allow=always submodule add ../other_repo -git commit -am "add submodule" diff --git a/test/integration/submoduleRemove/test.json b/test/integration/submoduleRemove/test.json deleted file mode 100644 index 87daa5360..000000000 --- a/test/integration/submoduleRemove/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Remove a submodule", - "speed": 20 -}