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:
@@ -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
|
||||
|
Reference in New Issue
Block a user