1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-28 09:08:41 +02:00

migrate branch reset integration test

This commit is contained in:
Jesse Duffield 2022-12-19 22:38:32 +11:00
parent b647241521
commit b13cfdfea0
66 changed files with 75 additions and 205 deletions

View File

@ -0,0 +1,54 @@
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to another branch",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("current-branch")
shell.EmptyCommit("root commit")
shell.NewBranch("other-branch")
shell.EmptyCommit("other-branch commit")
shell.Checkout("current-branch")
shell.EmptyCommit("current-branch commit")
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesWindow()
assert.CurrentViewName("localBranches")
assert.MatchSelectedLine(Contains("current-branch"))
input.NextItem()
assert.MatchSelectedLine(Contains("other-branch"))
input.PressKeys(keys.Commits.ViewResetOptions)
assert.InMenu()
assert.MatchCurrentViewTitle(Contains("reset to other-branch"))
assert.MatchSelectedLine(Contains("soft reset"))
input.NextItem()
assert.MatchSelectedLine(Contains("mixed reset"))
input.NextItem()
assert.MatchSelectedLine(Contains("hard reset"))
input.Confirm()
// ensure that we've returned from the menu before continuing
assert.CurrentViewName("localBranches")
// assert that we now have the expected commits in the commit panel
input.SwitchToCommitsWindow()
assert.CurrentViewName("commits")
assert.CommitCount(2)
assert.MatchSelectedLine(Contains("other-branch commit"))
input.NextItem()
assert.MatchSelectedLine(Contains("root commit"))
},
})

View File

@ -32,6 +32,7 @@ var tests = []*components.IntegrationTest{
branch.Rebase,
branch.RebaseAndDrop,
branch.Suggestions,
branch.Reset,
cherry_pick.CherryPick,
cherry_pick.CherryPickConflicts,
commit.Commit,

View File

@ -1 +0,0 @@
fourth commit on master

View File

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

View File

@ -1 +0,0 @@
7cd86f0c3e1894b4270d0bf9fa246c33568f9bf1

View File

@ -1,18 +0,0 @@
0000000000000000000000000000000000000000 3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 CI <CI@example.com> 1617686737 +1000 commit (initial): first commit
3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 CI <CI@example.com> 1617686737 +1000 checkout: moving from master to develop
3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 c23c3e0496a9b3decc42344bfd94514f0834b93c CI <CI@example.com> 1617686737 +1000 commit: first commit on develop
c23c3e0496a9b3decc42344bfd94514f0834b93c 3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 CI <CI@example.com> 1617686737 +1000 checkout: moving from develop to master
3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 CI <CI@example.com> 1617686737 +1000 commit: first commit on master
bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 c23c3e0496a9b3decc42344bfd94514f0834b93c CI <CI@example.com> 1617686737 +1000 checkout: moving from master to develop
c23c3e0496a9b3decc42344bfd94514f0834b93c 8b24e74245461f6ad529c77c040fe17e415cf3da CI <CI@example.com> 1617686737 +1000 commit: second commit on develop
8b24e74245461f6ad529c77c040fe17e415cf3da bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 CI <CI@example.com> 1617686737 +1000 checkout: moving from develop to master
bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 106606554f129e8b6e4b942908734deef5628dcd CI <CI@example.com> 1617686737 +1000 commit: second commit on master
106606554f129e8b6e4b942908734deef5628dcd 8b24e74245461f6ad529c77c040fe17e415cf3da CI <CI@example.com> 1617686737 +1000 checkout: moving from master to develop
8b24e74245461f6ad529c77c040fe17e415cf3da eea0cf47f42fe8d027b4cecaf534ecc0673f7981 CI <CI@example.com> 1617686737 +1000 commit: third commit on develop
eea0cf47f42fe8d027b4cecaf534ecc0673f7981 106606554f129e8b6e4b942908734deef5628dcd CI <CI@example.com> 1617686737 +1000 checkout: moving from develop to master
106606554f129e8b6e4b942908734deef5628dcd a73e01f9d181ff16b3d821dd962e98accbd62936 CI <CI@example.com> 1617686737 +1000 commit: third commit on master
a73e01f9d181ff16b3d821dd962e98accbd62936 eea0cf47f42fe8d027b4cecaf534ecc0673f7981 CI <CI@example.com> 1617686737 +1000 checkout: moving from master to develop
eea0cf47f42fe8d027b4cecaf534ecc0673f7981 27ba706fa463253f9189b2f258430877d2b5ed4f CI <CI@example.com> 1617686737 +1000 commit: fourth commit on develop
27ba706fa463253f9189b2f258430877d2b5ed4f a73e01f9d181ff16b3d821dd962e98accbd62936 CI <CI@example.com> 1617686737 +1000 checkout: moving from develop to master
a73e01f9d181ff16b3d821dd962e98accbd62936 7cd86f0c3e1894b4270d0bf9fa246c33568f9bf1 CI <CI@example.com> 1617686737 +1000 commit: fourth commit on master
7cd86f0c3e1894b4270d0bf9fa246c33568f9bf1 27ba706fa463253f9189b2f258430877d2b5ed4f CI <CI@example.com> 1617686741 +1000 reset: moving to develop

View File

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 CI <CI@example.com> 1617686737 +1000 branch: Created from HEAD
3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 c23c3e0496a9b3decc42344bfd94514f0834b93c CI <CI@example.com> 1617686737 +1000 commit: first commit on develop
c23c3e0496a9b3decc42344bfd94514f0834b93c 8b24e74245461f6ad529c77c040fe17e415cf3da CI <CI@example.com> 1617686737 +1000 commit: second commit on develop
8b24e74245461f6ad529c77c040fe17e415cf3da eea0cf47f42fe8d027b4cecaf534ecc0673f7981 CI <CI@example.com> 1617686737 +1000 commit: third commit on develop
eea0cf47f42fe8d027b4cecaf534ecc0673f7981 27ba706fa463253f9189b2f258430877d2b5ed4f CI <CI@example.com> 1617686737 +1000 commit: fourth commit on develop

View File

@ -1,6 +0,0 @@
0000000000000000000000000000000000000000 3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 CI <CI@example.com> 1617686737 +1000 commit (initial): first commit
3714b55ba17f3d8b0233c6e5924a5e497eb09bb7 bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 CI <CI@example.com> 1617686737 +1000 commit: first commit on master
bd8db1919bbbbd4509ad4d9fa3baf546460e17a2 106606554f129e8b6e4b942908734deef5628dcd CI <CI@example.com> 1617686737 +1000 commit: second commit on master
106606554f129e8b6e4b942908734deef5628dcd a73e01f9d181ff16b3d821dd962e98accbd62936 CI <CI@example.com> 1617686737 +1000 commit: third commit on master
a73e01f9d181ff16b3d821dd962e98accbd62936 7cd86f0c3e1894b4270d0bf9fa246c33568f9bf1 CI <CI@example.com> 1617686737 +1000 commit: fourth commit on master
7cd86f0c3e1894b4270d0bf9fa246c33568f9bf1 27ba706fa463253f9189b2f258430877d2b5ed4f CI <CI@example.com> 1617686741 +1000 reset: moving to develop

View File

@ -1,3 +0,0 @@
x��A
Β0E]η³$Σ&“D„®z�I2EΑ4¥�ΰρ x�ξήƒ�j)ΟκSΫE@‡Ε'rθ’&&τ�Ά‹d�M―C\Ζd½Νjγ]Φ1ϋ1`�=ΩX8›#/Φ�!-θxPόn�ΊΓ4Γu�οςα²½δ’jΉ:ςδFgΤZ«ΎφSMώΔΥ!©®~Τ
έV_ωΝ@ν

View File

@ -1,2 +0,0 @@
x�ŽM
ƒ0»Î)Þ¾Pòb~J)¸òñå ÔˆÄÒãWèºf`¤,Ë«’a¾Ô MÛÁ[‘œq,6Gƒ˜µ$fëÆNFÍVmqÇZ ˆZ² ÙšŒ6iF+�˜]c!¢}hrèZVñ¨SÙ©èÞO|â²Í¸IYÄžƒoO3ЕµÖê¤çTÅŸºÊåØëD¿ŒÊJ oÌeS_ɨB)

View File

@ -1 +0,0 @@
xå�Ñ €0CývŠLÐÅ\ãj�VО´WÄí=Àü�„äãùM<†iìf.Œµ‚PUÊM¤HTá™3T¶`Q‘–¢9ƒ"×^òÂh‡d[éºóÓØËi+B�Ø;ç~¥/ Y:/–¸<PÃ

View File

@ -1,3 +0,0 @@
x��M
Β0F]η³$ΣΤό€�ΠU�1If¨`�RSπψΌ€ΫΗχψ^�¥< ¨Omg3&7ΆEf ΦK
WL‚N“Fς…s�)«�v^�3¬QBF�"h£Ι~ΐ�ƒ8xJ)f;cm©;L3ά¦ωΑ*Ϋ‹/©–;τ;g½uΖΑµΦ�ΣΥψΟΉ’zμm��u…Bοn«/hA£

View File

@ -1 +0,0 @@
xĺ�Ń €0Cýî™ ?Š3¸ĆµV¨=iOÄí=Ŕü�„äă…,ý8tWĆÚ@h*ő‚&R$jĚ*y¶¨Ę‘s-Üś”Č8v)¶Ňu㧱—ÓV„HęĽ÷żŇ�"ťË µćPż

View File

@ -1,6 +0,0 @@
x�ŽK
Â0@]ç³$ŸÉL
"BW=FšLh¡mJ‰âñ-x·�÷ॺ®skô¥"Gô–uì|&JAÜÐåâ
�âs2]GZíñ�­A-
£E�d
Åìm—˜“F]Ä° ñ©¸U|µ©Ðp|âº/rKu}€!ÈÃÕh­ÕIÏ©&êªMó‘áWAÝ Ë[–º«/v’@

View File

@ -1 +0,0 @@
27ba706fa463253f9189b2f258430877d2b5ed4f

View File

@ -1 +0,0 @@
27ba706fa463253f9189b2f258430877d2b5ed4f

View File

@ -1,63 +0,0 @@
Here is a story that has been told throuhg the ages
once upon a time there was a dog
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
once upon a time there was another dog

View File

@ -1 +0,0 @@
once upon a time there was a mouse

View File

@ -1 +0,0 @@
once upon a time there was a mouse

View File

@ -1 +0,0 @@
once upon a time there was a mouse

View File

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":1037,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1523,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2155,"Mod":0,"Key":256,"Ch":103},{"Timestamp":3379,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3563,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3900,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5939,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}

View File

@ -1,85 +0,0 @@
#!/bin/sh
set -e
cd $1
git init
git config user.email "CI@example.com"
git config user.name "CI"
function add_spacing {
for i in {1..60}
do
echo "..." >> $1
done
}
mkdir directory
echo "test1" > directory/file
echo "test1" > directory/file2
echo "Here is a story that has been told throuhg the ages" >> file1
git add file1
git add directory
git commit -m "first commit"
git checkout -b develop
echo "once upon a time there was a dog" >> file1
add_spacing file1
echo "once upon a time there was another dog" >> file1
git add file1
echo "test2" > directory/file
echo "test2" > directory/file2
git add directory
git commit -m "first commit on develop"
git checkout master
echo "once upon a time there was a cat" >> file1
add_spacing file1
echo "once upon a time there was another cat" >> file1
git add file1
echo "test3" > directory/file
echo "test3" > directory/file2
git add directory
git commit -m "first commit on master"
git checkout develop
echo "once upon a time there was a mouse" >> file3
git add file3
git commit -m "second commit on develop"
git checkout master
echo "once upon a time there was a horse" >> file3
git add file3
git commit -m "second commit on master"
git checkout develop
echo "once upon a time there was a mouse" >> file4
git add file4
git commit -m "third commit on develop"
git checkout master
echo "once upon a time there was a horse" >> file4
git add file4
git commit -m "third commit on master"
git checkout develop
echo "once upon a time there was a mouse" >> file5
git add file5
git commit -m "fourth commit on develop"
git checkout master
echo "once upon a time there was a horse" >> file5
git add file5
git commit -m "fourth commit on master"

View File

@ -1 +0,0 @@
{ "description": "In this test we fix some merge conflicts, ensuring that in the flat tree structure the conflicts are bubbled to the top, and that after resolving the conflicts your cursor stays on the same line, able to select the next conflicted file. We also switch to tree mode and ensure that works too.", "speed": 10 }

View File

@ -0,0 +1 @@
current-branch commit

View File

@ -0,0 +1 @@
ref: refs/heads/current-branch

View File

@ -0,0 +1 @@
bad42488b30daac9e329ccb76a758d78c484a463

View File

@ -8,3 +8,7 @@
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false
[protocol "file"]
allow = always

View File

@ -0,0 +1,6 @@
0000000000000000000000000000000000000000 bc64902742511e6be6e8d4f6aa90f113ab03f232 CI <CI@example.com> 1671449839 +1100 commit (initial): root commit
bc64902742511e6be6e8d4f6aa90f113ab03f232 bc64902742511e6be6e8d4f6aa90f113ab03f232 CI <CI@example.com> 1671449839 +1100 checkout: moving from current-branch to other-branch
bc64902742511e6be6e8d4f6aa90f113ab03f232 0e9962fc70276ff33de86f77f20ed4482273711a CI <CI@example.com> 1671449839 +1100 commit: other-branch commit
0e9962fc70276ff33de86f77f20ed4482273711a bc64902742511e6be6e8d4f6aa90f113ab03f232 CI <CI@example.com> 1671449839 +1100 checkout: moving from other-branch to current-branch
bc64902742511e6be6e8d4f6aa90f113ab03f232 bad42488b30daac9e329ccb76a758d78c484a463 CI <CI@example.com> 1671449839 +1100 commit: current-branch commit
bad42488b30daac9e329ccb76a758d78c484a463 0e9962fc70276ff33de86f77f20ed4482273711a CI <CI@example.com> 1671449840 +1100 reset: moving to other-branch

View File

@ -0,0 +1,3 @@
0000000000000000000000000000000000000000 bc64902742511e6be6e8d4f6aa90f113ab03f232 CI <CI@example.com> 1671449839 +1100 commit (initial): root commit
bc64902742511e6be6e8d4f6aa90f113ab03f232 bad42488b30daac9e329ccb76a758d78c484a463 CI <CI@example.com> 1671449839 +1100 commit: current-branch commit
bad42488b30daac9e329ccb76a758d78c484a463 0e9962fc70276ff33de86f77f20ed4482273711a CI <CI@example.com> 1671449840 +1100 reset: moving to other-branch

View File

@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 bc64902742511e6be6e8d4f6aa90f113ab03f232 CI <CI@example.com> 1671449839 +1100 branch: Created from HEAD
bc64902742511e6be6e8d4f6aa90f113ab03f232 0e9962fc70276ff33de86f77f20ed4482273711a CI <CI@example.com> 1671449839 +1100 commit: other-branch commit

View File

@ -0,0 +1 @@
0e9962fc70276ff33de86f77f20ed4482273711a

View File

@ -0,0 +1 @@
0e9962fc70276ff33de86f77f20ed4482273711a