1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-07 13:42:01 +02:00

migrate pullAndSetUpstream test

This commit is contained in:
Jesse Duffield 2023-02-19 11:51:42 +11:00
parent c599aaed51
commit a3096e720c
51 changed files with 48 additions and 111 deletions

View File

@ -0,0 +1,47 @@
package sync
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var PullAndSetUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Pull a commit from the remote, setting the upstream branch in the process",
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")
// 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("repo → master"))
t.Views().Files().IsFocused().Press(keys.Universal.Pull)
t.ExpectPopup().Prompt().
Title(Equals("Enter upstream as '<remote> <branchname>'")).
SuggestionLines(Equals("origin master")).
ConfirmFirstSuggestion()
t.Views().Commits().
Lines(
Contains("two"),
Contains("one"),
)
t.Views().Status().Content(Contains("✓ repo → master"))
},
})

View File

@ -73,5 +73,6 @@ var tests = []*components.IntegrationTest{
submodule.Reset,
sync.FetchPrune,
sync.Pull,
sync.PullAndSetUpstream,
sync.RenameBranchAndPull,
}

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/pullAndSetUpstream/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�ΝA
ƒ0@Ρ®s�ΩJF§“))Ές1™PΑ!")ΨΫΧ#tϋyπS5[ ρ¥ν�ΰ•Sρ‘ηπPΙD�ΒY°‹XΝΤg¦Σ½sρΣήu‡q‚η8½τ�¶­zKΥ@&ιI\½wg='M�δΞΎeYέ3“,Υ

View File

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

View File

@ -1 +0,0 @@
dffd8a2962e840dfcbce39a0315e0cded7873b29 branch 'master' of ../origin

View File

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

View File

@ -1 +0,0 @@
f11c72f0484c803d954446036bf464c3b8523330

View File

@ -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

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,7 +0,0 @@
0000000000000000000000000000000000000000 1f027c0e280612f8e5e2cf0a5361f6ab0c4baed6 CI <CI@example.com> 1648348714 +1100 commit (initial): myfile1
1f027c0e280612f8e5e2cf0a5361f6ab0c4baed6 f11c72f0484c803d954446036bf464c3b8523330 CI <CI@example.com> 1648348714 +1100 commit: myfile2
f11c72f0484c803d954446036bf464c3b8523330 64d950eb46bf13d35cd27dd7a3ad621422dee6ac CI <CI@example.com> 1648348715 +1100 commit: myfile3
64d950eb46bf13d35cd27dd7a3ad621422dee6ac dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348715 +1100 commit: myfile4
dffd8a2962e840dfcbce39a0315e0cded7873b29 f11c72f0484c803d954446036bf464c3b8523330 CI <CI@example.com> 1648348715 +1100 reset: moving to HEAD~2
f11c72f0484c803d954446036bf464c3b8523330 dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348721 +1100 rebase -i (start): checkout dffd8a2962e840dfcbce39a0315e0cded7873b29
dffd8a2962e840dfcbce39a0315e0cded7873b29 dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348721 +1100 rebase -i (finish): returning to refs/heads/master

View File

@ -1,6 +0,0 @@
0000000000000000000000000000000000000000 1f027c0e280612f8e5e2cf0a5361f6ab0c4baed6 CI <CI@example.com> 1648348714 +1100 commit (initial): myfile1
1f027c0e280612f8e5e2cf0a5361f6ab0c4baed6 f11c72f0484c803d954446036bf464c3b8523330 CI <CI@example.com> 1648348714 +1100 commit: myfile2
f11c72f0484c803d954446036bf464c3b8523330 64d950eb46bf13d35cd27dd7a3ad621422dee6ac CI <CI@example.com> 1648348715 +1100 commit: myfile3
64d950eb46bf13d35cd27dd7a3ad621422dee6ac dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348715 +1100 commit: myfile4
dffd8a2962e840dfcbce39a0315e0cded7873b29 f11c72f0484c803d954446036bf464c3b8523330 CI <CI@example.com> 1648348715 +1100 reset: moving to HEAD~2
f11c72f0484c803d954446036bf464c3b8523330 dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348721 +1100 rebase -i (finish): refs/heads/master onto dffd8a2962e840dfcbce39a0315e0cded7873b29

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 dffd8a2962e840dfcbce39a0315e0cded7873b29 CI <CI@example.com> 1648348715 +1100 fetch origin: storing head

View File

@ -1,2 +0,0 @@
x�ΝA
ƒ0@Ρ®s�ΩJF§“))Ές1™PΑ!")ΨΫΧ#tϋyπS5[ ρ¥ν�ΰ•Sρ‘ηπPΙD�ΒY°‹XΝΤg¦Σ½sρΣήu‡q‚η8½τ�¶­zKΥ@&ιI\½wg='M�δΞΎeYέ3“,Υ

View File

@ -1 +0,0 @@
dffd8a2962e840dfcbce39a0315e0cded7873b29

View File

@ -1 +0,0 @@
dffd8a2962e840dfcbce39a0315e0cded7873b29

View File

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":423,"Mod":0,"Key":256,"Ch":112},{"Timestamp":1032,"Mod":0,"Key":127,"Ch":127},{"Timestamp":1216,"Mod":0,"Key":127,"Ch":127},{"Timestamp":1376,"Mod":0,"Key":127,"Ch":127},{"Timestamp":1536,"Mod":0,"Key":127,"Ch":127},{"Timestamp":1687,"Mod":0,"Key":127,"Ch":127},{"Timestamp":1847,"Mod":0,"Key":127,"Ch":127},{"Timestamp":2016,"Mod":0,"Key":127,"Ch":127},{"Timestamp":2240,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3044,"Mod":0,"Key":27,"Ch":0},{"Timestamp":3768,"Mod":0,"Key":256,"Ch":112},{"Timestamp":4184,"Mod":0,"Key":256,"Ch":97},{"Timestamp":4232,"Mod":0,"Key":256,"Ch":115},{"Timestamp":4288,"Mod":0,"Key":256,"Ch":100},{"Timestamp":4728,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5488,"Mod":0,"Key":27,"Ch":0},{"Timestamp":5799,"Mod":0,"Key":256,"Ch":112},{"Timestamp":6273,"Mod":0,"Key":13,"Ch":13},{"Timestamp":7207,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}

View File

@ -1,35 +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"
echo test3 > myfile3
git add .
git commit -am "myfile3"
echo test4 > myfile4
git add .
git commit -am "myfile4"
cd ..
git clone --bare ./repo origin
cd repo
# the test is to ensure that we actually can pull these two commits back from the origin
git reset --hard HEAD~2
git remote add origin ../origin
git fetch origin

View File

@ -1,4 +0,0 @@
{
"description": "pull changes from the remote, setting upstream",
"speed": 10
}