1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Allow setting a default name when creating new branches

This commit is contained in:
Elliot Cubit
2024-04-09 15:41:26 -04:00
committed by Jesse Duffield
parent 436240bbeb
commit 5959f7bc8e
6 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var NewBranchWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Creating a new branch from a commit with a default name",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.UserConfig.Git.BranchPrefix = "myprefix/"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("commit 1")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit 1").IsSelected(),
).
SelectNextItem().
Press(keys.Universal.New).
Tap(func() {
branchName := "my-branch-name"
t.ExpectPopup().Prompt().Title(Contains("New branch name")).Type(branchName).Confirm()
t.Git().CurrentBranchName("myprefix/" + branchName)
})
},
})