1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-08 22:52:12 +02:00

Cleanup: move variable assignment out of the loop

It never changes inside this function, so there's no need to recompute it with
every loop iteration.
This commit is contained in:
Stefan Haller
2025-09-28 14:17:24 +02:00
parent 6478bf456b
commit d0c6e27fee

View File

@@ -1221,13 +1221,14 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil
} }
func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool { func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool {
nodePath := node.GetPath()
for _, selectedNode := range selectedNodes { for _, selectedNode := range selectedNodes {
if selectedNode.IsFile() { if selectedNode.IsFile() {
continue continue
} }
selectedNodePath := selectedNode.GetPath() selectedNodePath := selectedNode.GetPath()
nodePath := node.GetPath()
if strings.HasPrefix(nodePath, selectedNodePath+"/") { if strings.HasPrefix(nodePath, selectedNodePath+"/") {
return true return true