From d2059df543c0378170988f1f2277052d01b0e343 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 24 Mar 2025 15:29:03 +0100 Subject: [PATCH] Fix the bug mentioned in the previous commit --- pkg/gui/controllers/commits_files_controller.go | 3 ++- .../commit/checkout_file_from_range_selection_of_commits.go | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) 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")) }, })