1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/integration/tests/sync/fetch_prune.go
2022-12-30 22:42:32 +11:00

50 lines
1.4 KiB
Go

package sync
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FetchPrune = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fetch from the remote with the 'prune' option set in the git config",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.Git.AutoFetch = false
},
SetupRepo: func(shell *Shell) {
// This option makes it so that git checks for deleted branches in the remote
// upon fetching.
shell.SetConfig("fetch.prune", "true")
shell.EmptyCommit("my commit message")
shell.NewBranch("branch_to_remove")
shell.Checkout("master")
shell.CloneIntoRemote("origin")
shell.SetBranchUpstream("master", "origin/master")
shell.SetBranchUpstream("branch_to_remove", "origin/branch_to_remove")
// # 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
shell.RemoveRemoteBranch("origin", "branch_to_remove")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Lines(
Contains("master"),
Contains("branch_to_remove").DoesNotContain("upstream gone"),
)
t.Views().Files().
IsFocused().
Press(keys.Files.Fetch)
t.Views().Branches().
Lines(
Contains("master"),
Contains("branch_to_remove").Contains("upstream gone"),
)
},
})