From c7acf383990273b03cea012e4d14ab940c73333e Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 28 Jul 2026 17:40:03 +0200 Subject: [PATCH] Make isDescendentOfSelectedCommitFileNodes work for the root item The root item's path is ".", and the path of a file at top level is "./file". When using GetPath, this gives us "." and "file", respectively, and isDescendentOfSelectedCommitFileNodes would return false for these. Working with the internal paths (i.e. without stripping the leading "./") fixes this. There is no known breakage that is caused by this, that's why I'm not adding an integration test that demonstrates a bug. Equivalent to the change that was made to isDescendentOfSelectedNodes in files_controller.go in 302b621b681. --- pkg/gui/controllers/commits_files_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go index 5d4377fe1..da24b155c 100644 --- a/pkg/gui/controllers/commits_files_controller.go +++ b/pkg/gui/controllers/commits_files_controller.go @@ -642,10 +642,10 @@ func normalisedSelectedCommitFileNodes(selectedNodes []*filetree.CommitFileNode) } func isDescendentOfSelectedCommitFileNodes(node *filetree.CommitFileNode, selectedNodes []*filetree.CommitFileNode) bool { - nodePath := node.GetPath() + nodePath := node.GetInternalPath() for _, selectedNode := range selectedNodes { - selectedNodePath := selectedNode.GetPath() + selectedNodePath := selectedNode.GetInternalPath() if strings.HasPrefix(nodePath, selectedNodePath) && nodePath != selectedNodePath { return true