mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-15 22:26:40 +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:
parent
af5e25cfb5
commit
2b97f0fb43
@ -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"),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
@ -245,6 +245,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
sync.PushWithCredentialPrompt,
|
sync.PushWithCredentialPrompt,
|
||||||
sync.RenameBranchAndPull,
|
sync.RenameBranchAndPull,
|
||||||
tag.Checkout,
|
tag.Checkout,
|
||||||
|
tag.CheckoutWhenBranchWithSameNameExists,
|
||||||
tag.CreateWhileCommitting,
|
tag.CreateWhileCommitting,
|
||||||
tag.CrudAnnotated,
|
tag.CrudAnnotated,
|
||||||
tag.CrudLightweight,
|
tag.CrudLightweight,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user