mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
migrate submodule enter test
This commit is contained in:
@ -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)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
69
pkg/integration/tests/submodule/enter.go
Normal file
69
pkg/integration/tests/submodule/enter.go
Normal 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"))
|
||||
},
|
||||
})
|
@ -78,6 +78,7 @@ var tests = []*components.IntegrationTest{
|
||||
patch_building.BuildPatchAndCopyToClipboard,
|
||||
submodule.Add,
|
||||
submodule.Remove,
|
||||
submodule.Enter,
|
||||
}
|
||||
|
||||
func GetTests() []*components.IntegrationTest {
|
||||
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/master
|
@ -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
|
@ -1 +0,0 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
@ -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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x<01><>M
|
||||
<EFBFBD>0@<40><>s<EFBFBD><73>J&N<><4E><14><><EFBFBD><18> I<><1E><><EFBFBD>/<2F>Z<EFBFBD>H<><48><11><>R<EFBFBD><52>%d"<22><>r@<40>X<-4dG<64><47>5<EFBFBD>?<3F><><0E>fxN<78>(_<><5F>&<26><><EFBFBD><0B><0E><><EFBFBD>6<EFBFBD>]<5D><><EFBFBD><EFBFBD>פ˟\ճ<><D5B3><EFBFBD><EFBFBD>5,<2C>
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x<01><>K
|
||||
<EFBFBD>0@]<5D><14><0B><>L&PD<50><44><EFBFBD>H&S,4<><34>z{{<04><><EFBFBD><EFBFBD>㭵<EFBFBD>k<EFBFBD>¥":!<03><>(g<>LR*o<>!<21>(<28>$`<60><><0C>=<1F><>:8<>Fa-<05>b<EFBFBD>J-g<>dQN-<2D><>D<EFBFBD>wn<7F>'=<3D><>C><3E><><EFBFBD><EFBFBD>xkwm<77><6D><EFBFBD>\<5C><><EFBFBD><EFBFBD><1A>NzNu<4E>3W<33>;/<2F>x<EFBFBD><03><>9<EFBFBD>
|
@ -1,2 +0,0 @@
|
||||
# pack-refs with: peeled fully-peeled sorted
|
||||
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 refs/heads/master
|
@ -1 +0,0 @@
|
||||
test
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/master
|
@ -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
|
@ -1 +0,0 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
Binary file not shown.
@ -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
|
@ -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
|
@ -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
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/master
|
@ -1 +0,0 @@
|
||||
42530e986dbb65877ed8d61ca0c816e425e5c62e
|
@ -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
|
@ -1 +0,0 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
Binary file not shown.
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x<01><>M
|
||||
<EFBFBD>0@<40><>s<EFBFBD><73>J&N<><4E><14><><EFBFBD><18> I<><1E><><EFBFBD>/<2F>Z<EFBFBD>H<><48><11><>R<EFBFBD><52>%d"<22><>r@<40>X<-4dG<64><47>5<EFBFBD>?<3F><><0E>fxN<78>(_<><5F>&<26><><EFBFBD><0B><0E><><EFBFBD>6<EFBFBD>]<5D><><EFBFBD><EFBFBD>פ˟\ճ<><D5B3><EFBFBD><EFBFBD>5,<2C>
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x<01><>K
|
||||
<EFBFBD>0@]<5D><14><0B><>L&PD<50><44><EFBFBD>H&S,4<><34>z{{<04><><EFBFBD><EFBFBD>㭵<EFBFBD>k<EFBFBD>¥":!<03><>(g<>LR*o<>!<21>(<28>$`<60><><0C>=<1F><>:8<>Fa-<05>b<EFBFBD>J-g<>dQN-<2D><>D<EFBFBD>wn<7F>'=<3D><>C><3E><><EFBFBD><EFBFBD>xkwm<77><6D><EFBFBD>\<5C><><EFBFBD><EFBFBD><1A>NzNu<4E>3W<33>;/<2F>x<EFBFBD><03><>9<EFBFBD>
|
@ -1,2 +0,0 @@
|
||||
# pack-refs with: peeled fully-peeled sorted
|
||||
fc4712e93d74ad4fb68e2fd219ac253ae03e19a4 refs/remotes/origin/master
|
@ -1 +0,0 @@
|
||||
a50a5125768001a3ea263ffb7cafbc421a508153
|
@ -1 +0,0 @@
|
||||
ref: refs/remotes/origin/master
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x<01><>M
|
||||
<EFBFBD>0@<40><>s<EFBFBD><73>J&N<><4E><14><><EFBFBD><18> I<><1E><><EFBFBD>/<2F>Z<EFBFBD>H<><48><11><>R<EFBFBD><52>%d"<22><>r@<40>X<-4dG<64><47>5<EFBFBD>?<3F><><0E>fxN<78>(_<><5F>&<26><><EFBFBD><0B><0E><><EFBFBD>6<EFBFBD>]<5D><><EFBFBD><EFBFBD>פ˟\ճ<><D5B3><EFBFBD><EFBFBD>5,<2C>
|
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
x<01><>K
|
||||
<EFBFBD>0@]<5D><14>d2<64>9 "t<>cL<63>
|
||||
<EFBFBD>-5<05>o<EFBFBD><6F><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>^<08><>7U,,<2C>DCJ<43><4A><EFBFBD><EFBFBD><13>`
|
||||
:<3A>Ra<52>f<EFBFBD>M<EFBFBD>j<>ɒ<EFBFBD>+<2B>K<EFBFBD>u<EFBFBD>W<EFBFBD>ZȲd
|
@ -1,2 +0,0 @@
|
||||
x<01><>K
|
||||
<EFBFBD>0@]<5D><14><0B><>L&PD<50><44><EFBFBD>H&S,4<><34>z{{<04><><EFBFBD><EFBFBD>㭵<EFBFBD>k<EFBFBD>¥":!<03><>(g<>LR*o<>!<21>(<28>$`<60><><0C>=<1F><>:8<>Fa-<05>b<EFBFBD>J-g<>dQN-<2D><>D<EFBFBD>wn<7F>'=<3D><>C><3E><><EFBFBD><EFBFBD>xkwm<77><6D><EFBFBD>\<5C><><EFBFBD><EFBFBD><1A>NzNu<4E>3W<33>;/<2F>x<EFBFBD><03><>9<EFBFBD>
|
@ -1,4 +0,0 @@
|
||||
x<01><>M
|
||||
1@a<>=E<><45>$ӦMADp5<70><35>O<EFBFBD><4F>u<EFBFBD>1<EFBFBD><31>w<EFBFBD><77><EFBFBD><EFBFBD>-^]<5D>x<EFBFBD>ń<07>D,B<><42>Q<EFBFBD>ȉ<EFBFBD> <04><>n
|
||||
<EFBFBD>UG<55>S<EFBFBD>RA<52><41>M^j<05>x<EFBFBD>
|
||||
<EFBFBD>'N<1E><><EFBFBD>EJ<45><4A>ZmM<6D><4D>*&<><7F>l<EFBFBD>6<EFBFBD><36>m<EFBFBD><6D>7<EFBFBD><37>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>y<17><11><>u<EFBFBD>R<EFBFBD><52><1B><><EFBFBD>$99<39>
|
@ -1 +0,0 @@
|
||||
fd65a5c96edfc884a78bfe3d0240cb8a7ea0a31a
|
@ -1,3 +0,0 @@
|
||||
[submodule "other_repo"]
|
||||
path = other_repo
|
||||
url = ../other_repo
|
@ -1 +0,0 @@
|
||||
test1
|
@ -1 +0,0 @@
|
||||
test2
|
@ -1 +0,0 @@
|
||||
test2
|
@ -1 +0,0 @@
|
||||
gitdir: ../.git/modules/other_repo
|
@ -1 +0,0 @@
|
||||
test1
|
@ -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}]}
|
@ -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"
|
@ -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
|
||||
}
|
Reference in New Issue
Block a user