mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
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 302b621b68.
This commit is contained in:
parent
8fefe2b933
commit
c7acf38399
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue