1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00
Files
lazygit/pkg/integration/tests/stash/create_branch.go
Chris McDonnell 265557afa2 Add unambigious refs/ prefix to all stash references
Pretty basic fix, didn't seem to have any complications.
I only added the refs/ prefix to the FullRefName() method
to align with other similar methods, and to make this change
not impact any user facing modals.

Fixes: https://github.com/jesseduffield/lazygit/issues/4634

Also adds a test demonstrating that the stash show behavior is now fixed
2025-06-15 16:14:59 +02:00

58 lines
1.4 KiB
Go

package stash
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a branch from a stash entry",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.NewBranch("stash")
shell.Checkout("master")
shell.CreateFile("myfile", "content")
shell.GitAddAll()
shell.Stash("stash one")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().IsEmpty()
t.Views().Stash().
Focus().
Lines(
Contains("stash one").IsSelected(),
).
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Contains("New branch name (branch is off of 'stash@{0}: On master: stash one'")).
Type("new_branch").
Confirm()
})
t.Views().Files().IsEmpty()
t.Views().Branches().
IsFocused().
Lines(
Contains("new_branch").IsSelected(),
Contains("master"),
Contains("stash"),
).
PressEnter()
t.Views().SubCommits().
Lines(
Contains("On master: stash one").IsSelected(),
MatchesRegexp(`index on master:.*initial commit`),
Contains("initial commit"),
)
t.Views().Main().Content(Contains("myfile | 1 +"))
},
})