migrate submodule enter test

This commit is contained in:
Jesse Duffield 2023-02-12 17:40:53 +11:00
parent 7a3291a1f7
commit d7956c481d
68 changed files with 71 additions and 154 deletions

View file

@ -83,7 +83,7 @@ func (self *matcher) MatchesRegexp(target string) *matcher {
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)
return matched, fmt.Sprintf("Expected '%s' to match regular expression /%s/", value, target)
},
})
}

View file

@ -0,0 +1,69 @@
package submodule
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Enter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Enter a submodule, add a commit, and then stage the change in the parent repo",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.UserConfig.CustomCommands = []config.CustomCommand{
{
Key: "e",
Context: "files",
Command: "git commit --allow-empty -m \"empty commit\"",
},
}
},
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(),
).
// enter the submodule
PressEnter()
t.Views().Files().IsFocused().
Press("e").
Tap(func() {
t.Views().Commits().Content(Contains("empty commit"))
}).
// return to the parent repo
PressEscape()
t.Views().Submodules().IsFocused()
// we see the new commit in the submodule is ready to be staged in the parent repo
t.Views().Main().Content(Contains("> empty commit"))
t.Views().Files().Focus().
Lines(
MatchesRegexp(` M.*my_submodule \(submodule\)`).IsSelected(),
).
Tap(func() {
// main view also shows the new commit when we're looking at the submodule within the files view
t.Views().Main().Content(Contains("> empty commit"))
}).
PressPrimaryAction().
Press(keys.Files.CommitChanges).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().Type("submodule change").Confirm()
}).
IsEmpty()
t.Views().Submodules().Focus()
// we no longer report a new commit because we've committed it in the parent repo
t.Views().Main().Content(DoesNotContain("> empty commit"))
},
})

View file

@ -78,6 +78,7 @@ var tests = []*components.IntegrationTest{
patch_building.BuildPatchAndCopyToClipboard,
submodule.Add,
submodule.Remove,
submodule.Enter,
}
func GetTests() []*components.IntegrationTest {

View file

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

View file

@ -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/submoduleEnter/actual/./repo

View file

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

View file

@ -1,7 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store

View file

@ -1,2 +0,0 @@
x<01>ÍM
ƒ0@á®sŠÙJ&Nþ Á•Ç I¡Þ¾¡ÛÇ/µZ×HîÖÐâRÑì%d"Áàr@ÃX<-4dG…“5Š?ýݘfxNó(_®û&<26>Ôê Ðä£ñ6Â]£Öêª×¤ËŸ\Õ³¬› ú5

View file

@ -1,2 +0,0 @@
x<01><>K
Β0@]ηΩ ίL&PDθ<44>ΗH&S,4¶”z{{·ο½Εγ­µ¥kΒ¥":!Ρμ(g†LR*oΐ!¦(δ$`ρ «=ςκ:8πFa-<05>b”J-gΓdQN-ΐθDεwn‡'=<3D>ΣC>Ήν«άxkwmΑ<CE91>\„¤―Ζ£NzNuω3Wν;/«xυ•¶9η

View file

@ -1,2 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 refs/heads/master

View file

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

View file

@ -1,13 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[user]
email = CI@example.com
name = CI
[submodule "other_repo"]
url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleEnter/actual/other_repo
active = true

View file

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

View file

@ -1,7 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store

View file

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI <CI@example.com> 1534792759 +0100 commit (initial): myfile1
a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI <CI@example.com> 1534792759 +0100 commit: myfile2
42530e986dbb65877ed8d61ca0c816e425e5c62e fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 CI <CI@example.com> 1534792759 +0100 commit: myfile3
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 e1eb418c0ff98940d4ea817eebcff5dcdde645ce CI <CI@example.com> 1534792759 +0100 commit: add submodule
e1eb418c0ff98940d4ea817eebcff5dcdde645ce fd65a5c96edfc884a78bfe3d0240cb8a7ea0a31a CI <CI@example.com> 1648348036 +1100 commit: test

View file

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 a50a5125768001a3ea263ffb7cafbc421a508153 CI <CI@example.com> 1534792759 +0100 commit (initial): myfile1
a50a5125768001a3ea263ffb7cafbc421a508153 42530e986dbb65877ed8d61ca0c816e425e5c62e CI <CI@example.com> 1534792759 +0100 commit: myfile2
42530e986dbb65877ed8d61ca0c816e425e5c62e fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 CI <CI@example.com> 1534792759 +0100 commit: myfile3
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 e1eb418c0ff98940d4ea817eebcff5dcdde645ce CI <CI@example.com> 1534792759 +0100 commit: add submodule
e1eb418c0ff98940d4ea817eebcff5dcdde645ce fd65a5c96edfc884a78bfe3d0240cb8a7ea0a31a CI <CI@example.com> 1648348036 +1100 commit: test

View file

@ -1 +0,0 @@
42530e986dbb65877ed8d61ca0c816e425e5c62e

View file

@ -1,14 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
worktree = ../../../other_repo
[remote "origin"]
url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleEnter/actual/other_repo
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

View file

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

View file

@ -1,7 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store

View file

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 Jesse Duffield <jessedduffield@gmail.com> 1534792759 +0100 clone: from /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleEnter/actual/other_repo
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 42530e986dbb65877ed8d61ca0c816e425e5c62e Jesse Duffield <jessedduffield@gmail.com> 1648348031 +1100 rebase -i (start): checkout 42530e986dbb65877ed8d61ca0c816e425e5c62e
42530e986dbb65877ed8d61ca0c816e425e5c62e 42530e986dbb65877ed8d61ca0c816e425e5c62e Jesse Duffield <jessedduffield@gmail.com> 1648348031 +1100 rebase -i (finish): returning to refs/heads/master
42530e986dbb65877ed8d61ca0c816e425e5c62e a50a5125768001a3ea263ffb7cafbc421a508153 Jesse Duffield <jessedduffield@gmail.com> 1648348032 +1100 rebase -i (start): checkout a50a5125768001a3ea263ffb7cafbc421a508153
a50a5125768001a3ea263ffb7cafbc421a508153 a50a5125768001a3ea263ffb7cafbc421a508153 Jesse Duffield <jessedduffield@gmail.com> 1648348032 +1100 rebase -i (finish): returning to refs/heads/master

View file

@ -1,3 +0,0 @@
0000000000000000000000000000000000000000 fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 Jesse Duffield <jessedduffield@gmail.com> 1534792759 +0100 clone: from /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleEnter/actual/other_repo
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 42530e986dbb65877ed8d61ca0c816e425e5c62e Jesse Duffield <jessedduffield@gmail.com> 1648348031 +1100 rebase -i (finish): refs/heads/master onto 42530e986dbb65877ed8d61ca0c816e425e5c62e
42530e986dbb65877ed8d61ca0c816e425e5c62e a50a5125768001a3ea263ffb7cafbc421a508153 Jesse Duffield <jessedduffield@gmail.com> 1648348032 +1100 rebase -i (finish): refs/heads/master onto a50a5125768001a3ea263ffb7cafbc421a508153

View file

@ -1 +0,0 @@
0000000000000000000000000000000000000000 fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 Jesse Duffield <jessedduffield@gmail.com> 1534792759 +0100 clone: from /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/submoduleEnter/actual/other_repo

View file

@ -1,2 +0,0 @@
x<01>ÍM
ƒ0@á®sŠÙJ&Nþ Á•Ç I¡Þ¾¡ÛÇ/µZ×HîÖÐâRÑì%d"Áàr@ÃX<-4dG…“5Š?ýݘfxNó(_®û&<26>Ôê Ðä£ñ6Â]£Öêª×¤ËŸ\Õ³¬› ú5

View file

@ -1,2 +0,0 @@
x<01><>K
Β0@]ηΩ ίL&PDθ<44>ΗH&S,4¶”z{{·ο½Εγ­µ¥kΒ¥":!Ρμ(g†LR*oΐ!¦(δ$`ρ «=ςκ:8πFa-<05>b”J-gΓdQN-ΐθDεwn‡'=<3D>ΣC>Ήν«άxkwmΑ<CE91>\„¤―Ζ£NzNuω3Wν;/«xυ•¶9η

View file

@ -1,2 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 refs/remotes/origin/master

View file

@ -1 +0,0 @@
a50a5125768001a3ea263ffb7cafbc421a508153

View file

@ -1,2 +0,0 @@
x<01>ÍM
ƒ0@á®sŠÙJ&Nþ Á•Ç I¡Þ¾¡ÛÇ/µZ×HîÖÐâRÑì%d"Áàr@ÃX<-4dG…“5Š?ýݘfxNó(_®û&<26>Ôê Ðä£ñ6Â]£Öêª×¤ËŸ\Õ³¬› ú5

View file

@ -1,4 +0,0 @@
x<01>ŽK
Â0@]ç³d2ù9 "tÕcL“
<EFBFBD>-5<05>o<EFBFBD>àîñx——Ö^ñÔ7U,,ªDCJ”ŠÍ³` :ëRaŒf•Mßjöɲ+ÉKñuŠW¥ZȲd
N<14>ì<>ìý¹l0ŒpƇ~¥­³^òÒî`ƒó‰)†3ZDsØcªëŸ¹Rà³Om)û¬æê‘<K

View file

@ -1,2 +0,0 @@
x<01><>K
Β0@]ηΩ ίL&PDθ<44>ΗH&S,4¶”z{{·ο½Εγ­µ¥kΒ¥":!Ρμ(g†LR*oΐ!¦(δ$`ρ «=ςκ:8πFa-<05>b”J-gΓdQN-ΐθDεwn‡'=<3D>ΣC>Ήν«άxkwmΑ<CE91>\„¤―Ζ£NzNuω3Wν;/«xυ•¶9η

View file

@ -1,4 +0,0 @@
x<01>ÎM
1 @a×=E÷$Ó¦MADp5ÇèOŠu†1ÇwŽàöñ-^]Æx¨Å„ÝD,BìÞQäÈ‰Š î€n
­UG”SRA³æM^j¥xä
½'Nš—ÌEJí<4A>ZmM§*&ô¾lö6Ûóm¾Ê7<C38A>õ)§ºŒÅàÙyìÀìuŸRù“•·š$99Æ

View file

@ -1 +0,0 @@
fd65a5c96edfc884a78bfe3d0240cb8a7ea0a31a

View file

@ -1,3 +0,0 @@
[submodule "other_repo"]
path = other_repo
url = ../other_repo

View file

@ -1 +0,0 @@
gitdir: ../.git/modules/other_repo

View file

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":737,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1306,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1937,"Mod":0,"Key":259,"Ch":0},{"Timestamp":2162,"Mod":0,"Key":259,"Ch":0},{"Timestamp":2462,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2687,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3049,"Mod":0,"Key":256,"Ch":100},{"Timestamp":3242,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3862,"Mod":0,"Key":27,"Ch":0},{"Timestamp":5177,"Mod":0,"Key":256,"Ch":91},{"Timestamp":6272,"Mod":0,"Key":256,"Ch":32},{"Timestamp":6752,"Mod":0,"Key":256,"Ch":99},{"Timestamp":7007,"Mod":0,"Key":256,"Ch":116},{"Timestamp":7051,"Mod":0,"Key":256,"Ch":101},{"Timestamp":7232,"Mod":0,"Key":256,"Ch":115},{"Timestamp":7276,"Mod":0,"Key":256,"Ch":116},{"Timestamp":7547,"Mod":0,"Key":13,"Ch":13},{"Timestamp":8251,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}

View file

@ -1,30 +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"
echo test2 > myfile3
git add .
git commit -am "myfile3"
cd ..
git clone --bare ./repo other_repo
cd repo
git -c protocol.file.allow=always submodule add ../other_repo
git commit -am "add submodule"

View file

@ -1,4 +0,0 @@
{
"description": "Add submodule and enter. We enter the submodule, remove a couple of commits, and then stage the change in the parent repo",
"speed": 5
}