1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-17 22:32:58 +02:00

Add test demonstrating the problem

When there's a branch with the same name as the tag, the branch gets checked out
instead of the tag.
This commit is contained in:
Stefan Haller 2023-12-22 15:28:53 +01:00
parent af5e25cfb5
commit 2b97f0fb43
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CheckoutWhenBranchWithSameNameExists = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a tag when there's a branch with the same name",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.NewBranch("tag")
shell.Checkout("master")
shell.EmptyCommit("two")
shell.CreateLightweightTag("tag", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
PressPrimaryAction() // checkout tag
t.Views().Branches().IsFocused().Lines(
/* EXPECTED:
Contains("HEAD detached at tag").IsSelected(),
Contains("master"),
Contains("tag"),
ACTUAL: */
Contains("* tag").DoesNotContain("HEAD detached").IsSelected(),
Contains("master"),
)
},
})

View File

@ -245,6 +245,7 @@ var tests = []*components.IntegrationTest{
sync.PushWithCredentialPrompt,
sync.RenameBranchAndPull,
tag.Checkout,
tag.CheckoutWhenBranchWithSameNameExists,
tag.CreateWhileCommitting,
tag.CrudAnnotated,
tag.CrudLightweight,