From f244ec8251d77e41d02507811f49c388aa67a042 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 22 Dec 2023 15:30:54 +0100 Subject: [PATCH] Fix checking out a tag when a branch with the same name exists --- pkg/gui/controllers/tags_controller.go | 2 +- .../tests/tag/checkout_when_branch_with_same_name_exists.go | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/gui/controllers/tags_controller.go b/pkg/gui/controllers/tags_controller.go index 224ad83a4..dcbef4d2c 100644 --- a/pkg/gui/controllers/tags_controller.go +++ b/pkg/gui/controllers/tags_controller.go @@ -83,7 +83,7 @@ func (self *TagsController) GetOnRenderToMain() func() error { func (self *TagsController) checkout(tag *models.Tag) error { self.c.LogAction(self.c.Tr.Actions.CheckoutTag) - if err := self.c.Helpers().Refs.CheckoutRef(tag.Name, types.CheckoutRefOptions{}); err != nil { + if err := self.c.Helpers().Refs.CheckoutRef(tag.FullRefName(), types.CheckoutRefOptions{}); err != nil { return err } return self.c.PushContext(self.c.Contexts().Branches) diff --git a/pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go b/pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go index 2f291e29f..73e597f8f 100644 --- a/pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go +++ b/pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go @@ -26,13 +26,9 @@ var CheckoutWhenBranchWithSameNameExists = NewIntegrationTest(NewIntegrationTest 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"), ) }, })