2023-01-27 13:14:03 +02:00
|
|
|
package branch
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
var DetachedHead = NewIntegrationTest(NewIntegrationTestArgs{
|
|
|
|
Description: "Create a new branch on detached head",
|
2023-05-21 09:00:29 +02:00
|
|
|
ExtraCmdArgs: []string{},
|
2023-01-27 13:14:03 +02:00
|
|
|
Skip: false,
|
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.
|
|
|
|
CreateNCommits(10).
|
|
|
|
Checkout("HEAD^")
|
|
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
|
|
t.Views().Branches().
|
|
|
|
Focus().
|
|
|
|
Lines(
|
|
|
|
MatchesRegexp(`\*.*HEAD`).IsSelected(),
|
|
|
|
MatchesRegexp(`master`),
|
|
|
|
).
|
|
|
|
Press(keys.Universal.New)
|
|
|
|
|
|
|
|
t.ExpectPopup().Prompt().
|
2023-05-25 13:11:51 +02:00
|
|
|
Title(MatchesRegexp(`^New branch name \(branch is off of '[0-9a-f]+'\)$`)).
|
2023-01-27 13:14:03 +02:00
|
|
|
Type("new-branch").
|
|
|
|
Confirm()
|
|
|
|
|
|
|
|
t.Views().Branches().
|
|
|
|
Lines(
|
|
|
|
MatchesRegexp(`\* new-branch`).IsSelected(),
|
|
|
|
MatchesRegexp(`master`),
|
|
|
|
)
|
|
|
|
|
|
|
|
t.Git().CurrentBranchName("new-branch")
|
|
|
|
},
|
|
|
|
})
|