mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-04 03:48:07 +02:00
migrate forcePush integration test
This commit is contained in:
parent
0ac869a415
commit
31d796ee75
@ -72,6 +72,10 @@ func (self *Views) Branches() *ViewDriver {
|
||||
return self.byName("localBranches")
|
||||
}
|
||||
|
||||
func (self *Views) Remotes() *ViewDriver {
|
||||
return self.byName("remotes")
|
||||
}
|
||||
|
||||
func (self *Views) RemoteBranches() *ViewDriver {
|
||||
return self.byName("remoteBranches")
|
||||
}
|
||||
|
58
pkg/integration/tests/sync/force_push.go
Normal file
58
pkg/integration/tests/sync/force_push.go
Normal file
@ -0,0 +1,58 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var ForcePush = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Push to a remote with new commits, requiring a force push",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.UserConfig.Git.AutoFetch = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.EmptyCommit("two")
|
||||
|
||||
shell.CloneIntoRemote("origin")
|
||||
shell.SetBranchUpstream("master", "origin/master")
|
||||
|
||||
// remove the 'two' commit so that we have something to pull from the remote
|
||||
shell.HardReset("HEAD^")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("one"),
|
||||
)
|
||||
|
||||
t.Views().Status().Content(Contains("↓1 repo → master"))
|
||||
|
||||
t.Views().Files().IsFocused().Press(keys.Universal.Push)
|
||||
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Force push")).
|
||||
Content(Equals("Your branch has diverged from the remote branch. Press 'esc' to cancel, or 'enter' to force push.")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("one"),
|
||||
)
|
||||
|
||||
t.Views().Status().Content(Contains("✓ repo → master"))
|
||||
|
||||
t.Views().Remotes().Focus().
|
||||
Lines(Contains("origin")).
|
||||
PressEnter()
|
||||
|
||||
t.Views().RemoteBranches().IsFocused().
|
||||
Lines(Contains("master")).
|
||||
PressEnter()
|
||||
|
||||
t.Views().SubCommits().IsFocused().
|
||||
Lines(Contains("one"))
|
||||
},
|
||||
})
|
@ -72,6 +72,7 @@ var tests = []*components.IntegrationTest{
|
||||
submodule.Remove,
|
||||
submodule.Reset,
|
||||
sync.FetchPrune,
|
||||
sync.ForcePush,
|
||||
sync.Pull,
|
||||
sync.PullAndSetUpstream,
|
||||
sync.RenameBranchAndPull,
|
||||
|
@ -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/forcePush/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�ÎA
|
||||
Â0@Q×9Eö‚d’ÌtD„®zŒ¤™`ÁØR"èííÜ~ÞâÏkkK· ñÔwU›†!¡TWŠj%©™±'*ÞgW}2[ÚõÕ-"²dÉ¡°gEVÉ•„e€ÄaÆ\Lz÷ǺÛq²×qºë'µí©—ym79 wNìÀ9sÔcªëŸÜ´o]žêÍz9‹
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x�ŽA
|
||||
Â0E]çْɤÍD„®zŒd:ƒcK‰ ·7Gpõáñ|Þj]›…Ní±¾@D¦
ˆšªæPÉ1ÏC_³çC^ÍÆ(y!Ö”tÐŽ‚¤^'H1‹÷L&¿Ûc;ì4Ûë4ßå“ëþ”oõfa„ƒw.Ù3€s¦Ó~ªÉŸº©_]Ÿ‚æe-;7
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
# pack-refs with: peeled fully-peeled sorted
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 refs/heads/master
|
@ -1 +0,0 @@
|
||||
e38b0dbe9634034957d8ebe0088587abd9ae938d
|
@ -1 +0,0 @@
|
||||
myfile4
|
@ -1 +0,0 @@
|
||||
b8568c2ecaef7e2f47647057ad47b040e8c5df53 branch 'master' of ../origin
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/master
|
@ -1 +0,0 @@
|
||||
b8568c2ecaef7e2f47647057ad47b040e8c5df53
|
@ -1,16 +0,0 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
||||
[remote "origin"]
|
||||
url = ../origin
|
||||
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 5558e3589b913d8280499a5f9bf698971a83c5bd CI <CI@example.com> 1648352009 +1100 commit (initial): myfile1
|
||||
5558e3589b913d8280499a5f9bf698971a83c5bd 77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 CI <CI@example.com> 1648352009 +1100 commit: myfile2
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 b8568c2ecaef7e2f47647057ad47b040e8c5df53 CI <CI@example.com> 1648352009 +1100 commit: myfile3
|
||||
b8568c2ecaef7e2f47647057ad47b040e8c5df53 77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 CI <CI@example.com> 1648352009 +1100 reset: moving to HEAD^
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 e38b0dbe9634034957d8ebe0088587abd9ae938d CI <CI@example.com> 1648352009 +1100 commit: myfile4
|
@ -1,5 +0,0 @@
|
||||
0000000000000000000000000000000000000000 5558e3589b913d8280499a5f9bf698971a83c5bd CI <CI@example.com> 1648352009 +1100 commit (initial): myfile1
|
||||
5558e3589b913d8280499a5f9bf698971a83c5bd 77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 CI <CI@example.com> 1648352009 +1100 commit: myfile2
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 b8568c2ecaef7e2f47647057ad47b040e8c5df53 CI <CI@example.com> 1648352009 +1100 commit: myfile3
|
||||
b8568c2ecaef7e2f47647057ad47b040e8c5df53 77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 CI <CI@example.com> 1648352009 +1100 reset: moving to HEAD^
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 e38b0dbe9634034957d8ebe0088587abd9ae938d CI <CI@example.com> 1648352009 +1100 commit: myfile4
|
@ -1,3 +0,0 @@
|
||||
0000000000000000000000000000000000000000 77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 CI <CI@example.com> 1648352009 +1100 fetch origin: storing head
|
||||
77ead8cf99f5fa1084e9ffa40eb18f37157b22c8 b8568c2ecaef7e2f47647057ad47b040e8c5df53 CI <CI@example.com> 1648352009 +1100 update by push
|
||||
b8568c2ecaef7e2f47647057ad47b040e8c5df53 e38b0dbe9634034957d8ebe0088587abd9ae938d CI <CI@example.com> 1648352011 +1100 update by push
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x�ÎA
|
||||
Â0@Q×9Eö‚d’ÌtD„®zŒ¤™`ÁØR"èííÜ~ÞâÏkkK· ñÔwU›†!¡TWŠj%©™±'*ÞgW}2[ÚõÕ-"²dÉ¡°gEVÉ•„e€ÄaÆ\Lz÷ǺÛq²×qºë'µí©—ym79 wNìÀ9sÔcªëŸÜ´o]žêÍz9‹
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x�ŽA
|
||||
Â0E]çْɤÍD„®zŒd:ƒcK‰ ·7Gpõáñ|Þj]›…Ní±¾@D¦
ˆšªæPÉ1ÏC_³çC^ÍÆ(y!Ö”tÐŽ‚¤^'H1‹÷L&¿Ûc;ì4Ûë4ßå“ëþ”oõfa„ƒw.Ù3€s¦Ó~ªÉŸº©_]Ÿ‚æe-;7
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
e38b0dbe9634034957d8ebe0088587abd9ae938d
|
@ -1 +0,0 @@
|
||||
e38b0dbe9634034957d8ebe0088587abd9ae938d
|
@ -1 +0,0 @@
|
||||
test1
|
@ -1 +0,0 @@
|
||||
test2
|
@ -1 +0,0 @@
|
||||
test4
|
@ -1 +0,0 @@
|
||||
{"KeyEvents":[{"Timestamp":1054,"Mod":0,"Key":256,"Ch":80},{"Timestamp":1736,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2486,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
set -e
|
||||
|
||||
cd $1
|
||||
|
||||
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 origin
|
||||
|
||||
cd repo
|
||||
|
||||
git remote add origin ../origin
|
||||
git fetch origin
|
||||
git branch --set-upstream-to=origin/master master
|
||||
|
||||
echo test3 > myfile3
|
||||
git add .
|
||||
git commit -am "myfile3"
|
||||
|
||||
git push origin master
|
||||
|
||||
git reset --hard HEAD^
|
||||
|
||||
echo test4 > myfile4
|
||||
git add .
|
||||
git commit -am "myfile4"
|
||||
|
@ -1 +0,0 @@
|
||||
{ "description": "force push with lease if required", "speed": 10 }
|
Loading…
Reference in New Issue
Block a user