1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package worktree
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FastForwardWorktreeBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fast-forward a linked worktree branch from another worktree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// both main and linked worktree will have changed to fast-forward
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("README.md", "hello world")
shell.Commit("initial commit")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.NewBranch("newbranch")
shell.CloneIntoRemote("origin")
shell.SetBranchUpstream("mybranch", "origin/mybranch")
shell.SetBranchUpstream("newbranch", "origin/newbranch")
// remove the 'three' commit so that we have something to pull from the remote
shell.HardReset("HEAD^")
shell.Checkout("mybranch")
shell.HardReset("HEAD^")
shell.AddWorktreeCheckout("newbranch", "../linked-worktree")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("mybranch").Contains("↓1").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓").IsSelected(),
Contains("newbranch (worktree)").Contains("↓1"),
).
NavigateToLine(Contains("newbranch (worktree)")).
Press(keys.Branches.FastForward).
Lines(
Contains("mybranch").Contains("✓"),
Contains("newbranch (worktree)").Contains("✓").IsSelected(),
)
},
})
|