mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-23 22:24:51 +02:00
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
This commit is contained in:
committed by
Stefan Haller
parent
aa23a6e2b5
commit
265557afa2
@@ -12,6 +12,8 @@ var Apply = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.NewBranch("stash")
|
||||
shell.Checkout("master")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
shell.Stash("stash one")
|
||||
|
||||
@@ -12,6 +12,8 @@ var CreateBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
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")
|
||||
@@ -39,6 +41,7 @@ var CreateBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Lines(
|
||||
Contains("new_branch").IsSelected(),
|
||||
Contains("master"),
|
||||
Contains("stash"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ var Drop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.NewBranch("stash")
|
||||
shell.Checkout("master")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
shell.Stash("stash one")
|
||||
|
||||
@@ -12,6 +12,8 @@ var Pop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.NewBranch("stash")
|
||||
shell.Checkout("master")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
shell.Stash("stash one")
|
||||
|
||||
@@ -13,6 +13,8 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("blah").
|
||||
NewBranch("stash").
|
||||
Checkout("master").
|
||||
CreateFileAndAdd("file-1", "change to stash1").
|
||||
Stash("foo").
|
||||
CreateFileAndAdd("file-2", "change to stash2").
|
||||
|
||||
43
pkg/integration/tests/stash/show_with_branch_named_stash.go
Normal file
43
pkg/integration/tests/stash/show_with_branch_named_stash.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package stash
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var ShowWithBranchNamedStash = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "View stash when there is a branch also named 'stash'",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
|
||||
shell.NewBranch("stash")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Stash().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
Lines(
|
||||
Contains("file"),
|
||||
).
|
||||
Press(keys.Files.StashAllChanges)
|
||||
|
||||
t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm()
|
||||
|
||||
t.Views().Stash().
|
||||
Lines(
|
||||
MatchesRegexp(`\ds .* my stashed file`),
|
||||
)
|
||||
|
||||
t.Views().Files().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Stash().Focus()
|
||||
t.Views().Main().ContainsLines(Equals(" file | 1 +"))
|
||||
},
|
||||
})
|
||||
@@ -12,6 +12,8 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.NewBranch("stash")
|
||||
shell.Checkout("master")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
},
|
||||
|
||||
@@ -352,6 +352,7 @@ var tests = []*components.IntegrationTest{
|
||||
stash.Pop,
|
||||
stash.PreventDiscardingFileChanges,
|
||||
stash.Rename,
|
||||
stash.ShowWithBranchNamedStash,
|
||||
stash.Stash,
|
||||
stash.StashAll,
|
||||
stash.StashAndKeepIndex,
|
||||
|
||||
Reference in New Issue
Block a user