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 committed 2025-10-08 15:09:35 +02:00
1 parent 6478bf456b
commit d0c6e27fee
1 file changed
+2 -1
+2 -1
View File
@@ -1221,13 +1221,14 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil
}
func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool {
nodePath := node.GetPath()
for _, selectedNode := range selectedNodes {
if selectedNode.IsFile() {
continue
}
selectedNodePath := selectedNode.GetPath()
nodePath := node.GetPath()
if strings.HasPrefix(nodePath, selectedNodePath+"/") {
return true