mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
add git fetch prune integration test
This commit is contained in:
parent
4abd80e2c4
commit
ae10a5ea88
@ -89,12 +89,12 @@ func RunTests(
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
if test.Skip && !includeSkipped {
|
||||
logf("skipping test: %s", test.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
fnWrapper(test, func(t *testing.T) error { //nolint: thelper
|
||||
if test.Skip && !includeSkipped {
|
||||
logf("skipping test: %s", test.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
speeds := getTestSpeeds(test.Speed, mode, speedEnv)
|
||||
testPath := filepath.Join(testDir, test.Name)
|
||||
actualRepoDir := filepath.Join(testPath, "actual")
|
||||
@ -357,6 +357,7 @@ func generateSnapshot(dir string) (string, error) {
|
||||
snapshot := ""
|
||||
|
||||
cmdStrs := []string{
|
||||
`remote show -n origin`, // remote branches
|
||||
`status`, // file tree
|
||||
`log --pretty=%B -p -1`, // log
|
||||
`tag -n`, // tags
|
||||
|
10
test/integration/fetchPrune/config/config.yml
Normal file
10
test/integration/fetchPrune/config/config.yml
Normal file
@ -0,0 +1,10 @@
|
||||
disableStartupPopups: true
|
||||
git:
|
||||
autoFetch: false
|
||||
gui:
|
||||
theme:
|
||||
activeBorderColor:
|
||||
- green
|
||||
- bold
|
||||
SelectedRangeBgcolor:
|
||||
- reverse
|
@ -0,0 +1 @@
|
||||
myfile1
|
@ -0,0 +1 @@
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 branch 'master' of ../actual_remote
|
1
test/integration/fetchPrune/expected/.git_keep/HEAD
Normal file
1
test/integration/fetchPrune/expected/.git_keep/HEAD
Normal file
@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
21
test/integration/fetchPrune/expected/.git_keep/config
Normal file
21
test/integration/fetchPrune/expected/.git_keep/config
Normal file
@ -0,0 +1,21 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
||||
[fetch]
|
||||
prune = true
|
||||
[remote "origin"]
|
||||
url = ../actual_remote
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "master"]
|
||||
remote = origin
|
||||
merge = refs/heads/master
|
||||
[branch "other_branch"]
|
||||
remote = origin
|
||||
merge = refs/heads/other_branch
|
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
BIN
test/integration/fetchPrune/expected/.git_keep/index
Normal file
BIN
test/integration/fetchPrune/expected/.git_keep/index
Normal file
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
# 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
|
3
test/integration/fetchPrune/expected/.git_keep/logs/HEAD
Normal file
3
test/integration/fetchPrune/expected/.git_keep/logs/HEAD
Normal file
@ -0,0 +1,3 @@
|
||||
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 commit (initial): myfile1
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 checkout: moving from master to other_branch
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 checkout: moving from other_branch to master
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 commit (initial): myfile1
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 branch: Created from HEAD
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290938 +1100 fetch origin: storing head
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
# pack-refs with: peeled fully-peeled sorted
|
@ -0,0 +1 @@
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
|
@ -0,0 +1 @@
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
|
@ -0,0 +1 @@
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1
|
1
test/integration/fetchPrune/expected/myfile1
Normal file
1
test/integration/fetchPrune/expected/myfile1
Normal file
@ -0,0 +1 @@
|
||||
test1
|
1
test/integration/fetchPrune/expected_remote/HEAD
Normal file
1
test/integration/fetchPrune/expected_remote/HEAD
Normal file
@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
8
test/integration/fetchPrune/expected_remote/config
Normal file
8
test/integration/fetchPrune/expected_remote/config
Normal file
@ -0,0 +1,8 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[remote "origin"]
|
||||
url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/fetchPrune/./actual
|
1
test/integration/fetchPrune/expected_remote/description
Normal file
1
test/integration/fetchPrune/expected_remote/description
Normal file
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
7
test/integration/fetchPrune/expected_remote/info/exclude
Normal file
7
test/integration/fetchPrune/expected_remote/info/exclude
Normal file
@ -0,0 +1,7 @@
|
||||
# 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.
2
test/integration/fetchPrune/expected_remote/packed-refs
Normal file
2
test/integration/fetchPrune/expected_remote/packed-refs
Normal file
@ -0,0 +1,2 @@
|
||||
# pack-refs with: peeled fully-peeled sorted
|
||||
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 refs/heads/master
|
1
test/integration/fetchPrune/recording.json
Normal file
1
test/integration/fetchPrune/recording.json
Normal file
@ -0,0 +1 @@
|
||||
{"KeyEvents":[{"Timestamp":608,"Mod":0,"Key":256,"Ch":102},{"Timestamp":1568,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
34
test/integration/fetchPrune/setup.sh
Normal file
34
test/integration/fetchPrune/setup.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd $1
|
||||
|
||||
git init
|
||||
|
||||
git config user.email "CI@example.com"
|
||||
git config user.name "CI"
|
||||
|
||||
# we're setting this to ensure that it's honoured by the fetch command
|
||||
git config fetch.prune true
|
||||
|
||||
echo test1 > myfile1
|
||||
git add .
|
||||
git commit -am "myfile1"
|
||||
|
||||
git checkout -b other_branch
|
||||
git checkout master
|
||||
|
||||
cd ..
|
||||
git clone --bare ./actual actual_remote
|
||||
|
||||
cd actual
|
||||
|
||||
git remote add origin ../actual_remote
|
||||
git fetch origin
|
||||
git branch --set-upstream-to=origin/master master
|
||||
git branch --set-upstream-to=origin/other_branch other_branch
|
||||
|
||||
# unbenownst to our test repo we're removing the branch on the remote, so upon
|
||||
# fetching with prune: true we expect git to realise the remote branch is gone
|
||||
git -C ../actual_remote branch -d other_branch
|
4
test/integration/fetchPrune/test.json
Normal file
4
test/integration/fetchPrune/test.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"description": "fetch from the remote with the 'prune' option set in the git config",
|
||||
"speed": 10
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user