1
0
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:
Jesse Duffield 2022-03-26 21:18:10 +11:00
parent 4abd80e2c4
commit ae10a5ea88
32 changed files with 117 additions and 5 deletions

View File

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

View File

@ -0,0 +1,10 @@
disableStartupPopups: true
git:
autoFetch: false
gui:
theme:
activeBorderColor:
- green
- bold
SelectedRangeBgcolor:
- reverse

View File

@ -0,0 +1 @@
myfile1

View File

@ -0,0 +1 @@
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 branch 'master' of ../actual_remote

View File

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

View 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

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

Binary file not shown.

View 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

View 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

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 commit (initial): myfile1

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1 CI <CI@example.com> 1648290937 +1100 branch: Created from HEAD

View File

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

View File

@ -0,0 +1 @@
# pack-refs with: peeled fully-peeled sorted

View File

@ -0,0 +1 @@
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1

View File

@ -0,0 +1 @@
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1

View File

@ -0,0 +1 @@
f3ff4de48fa4e8fdb4f3631e58841ba81047d8f1

View File

@ -0,0 +1 @@
test1

View File

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

View 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

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View 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

View File

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

View 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}]}

View 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

View File

@ -0,0 +1,4 @@
{
"description": "fetch from the remote with the 'prune' option set in the git config",
"speed": 10
}