1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-22 04:42:37 +03:00
Files
lazygit/pkg/integration/tests/remote/add_fork_remote.go
Karol Zwolak 3892c40666 feat: add fork remote command
The command allows you to quickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote.
2025-11-16 17:26:00 +01:00

48 lines
1.1 KiB
Go

package remote
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddForkRemote = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Use the 'Add fork remote' command to add a fork remote and check out a branch from it",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("commit")
shell.CloneIntoRemote("origin")
shell.NewBranch("feature")
shell.Clone("fork")
shell.Checkout("master")
shell.RemoveBranch("feature")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Remotes().
Focus().
Lines(
Contains("origin").IsSelected(),
).
Press(keys.Branches.AddForkRemote)
t.ExpectPopup().Prompt().
Title(Equals("Fork owner (username/org). Use username:branch to check out a branch")).
Type("fork:feature").
Confirm()
t.Views().Remotes().
Lines(
Contains("origin"),
Contains("fork").IsSelected(),
)
t.Views().Branches().
IsFocused().
Lines(
Contains("feature ✓"),
Contains("master"),
)
},
})