|
| 1 | +package sync |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var FetchAndAutoForwardBranchesAllBranchesCheckedOutInOtherWorktree = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Fetch from remote and auto-forward branches with config set to 'allBranches'; check that this skips branches checked out by another worktree", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + SetupConfig: func(config *config.AppConfig) { |
| 13 | + config.GetUserConfig().Git.AutoForwardBranches = "allBranches" |
| 14 | + config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" |
| 15 | + }, |
| 16 | + SetupRepo: func(shell *Shell) { |
| 17 | + shell.CreateNCommits(3) |
| 18 | + shell.NewBranch("feature") |
| 19 | + shell.NewBranch("diverged") |
| 20 | + shell.CloneIntoRemote("origin") |
| 21 | + shell.SetBranchUpstream("master", "origin/master") |
| 22 | + shell.SetBranchUpstream("feature", "origin/feature") |
| 23 | + shell.SetBranchUpstream("diverged", "origin/diverged") |
| 24 | + shell.Checkout("master") |
| 25 | + shell.HardReset("HEAD^") |
| 26 | + shell.Checkout("feature") |
| 27 | + shell.HardReset("HEAD~2") |
| 28 | + shell.Checkout("diverged") |
| 29 | + shell.HardReset("HEAD~2") |
| 30 | + shell.EmptyCommit("local") |
| 31 | + shell.NewBranch("checked-out") |
| 32 | + |
| 33 | + shell.AddWorktreeCheckout("master", "../linked-worktree") |
| 34 | + }, |
| 35 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 36 | + t.Views().Branches(). |
| 37 | + Lines( |
| 38 | + Contains("checked-out").IsSelected(), |
| 39 | + Contains("diverged ↓2↑1"), |
| 40 | + Contains("feature ↓2").DoesNotContain("↑"), |
| 41 | + Contains("master (worktree) ↓1").DoesNotContain("↑"), |
| 42 | + ) |
| 43 | + |
| 44 | + t.Views().Files(). |
| 45 | + IsFocused(). |
| 46 | + Press(keys.Files.Fetch) |
| 47 | + |
| 48 | + // AutoForwardBranches is "allBranches": both master and feature get forwarded |
| 49 | + t.Views().Branches(). |
| 50 | + Lines( |
| 51 | + Contains("checked-out").IsSelected(), |
| 52 | + Contains("diverged ↓2↑1"), |
| 53 | + Contains("feature ✓"), |
| 54 | + Contains("master (worktree) ↓1"), |
| 55 | + ) |
| 56 | + }, |
| 57 | +}) |
0 commit comments