diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go index a9db34b7e..68a826eb8 100644 --- a/pkg/gui/controllers/commits_files_controller.go +++ b/pkg/gui/controllers/commits_files_controller.go @@ -292,7 +292,8 @@ func (self *CommitFilesController) openCopyMenu() error { func (self *CommitFilesController) checkout(node *filetree.CommitFileNode) error { self.c.LogAction(self.c.Tr.Actions.CheckoutFile) - if err := self.c.Git().WorkingTree.CheckoutFile(self.context().GetRef().RefName(), node.GetPath()); err != nil { + _, to := self.context().GetFromAndToForDiff() + if err := self.c.Git().WorkingTree.CheckoutFile(to, node.GetPath()); err != nil { return err } diff --git a/pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go b/pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go index 899458da1..28b8f966c 100644 --- a/pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go +++ b/pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go @@ -51,9 +51,6 @@ var CheckoutFileFromRangeSelectionOfCommits = NewIntegrationTest(NewIntegrationT Equals("M file.txt"), ) - /* EXPECTED: t.FileSystem().FileContent("file.txt", Equals("three\n")) - ACTUAL: */ - t.FileSystem().FileContent("file.txt", Equals("two\n")) }, })