Skip to content

Commit

Permalink
fixup! refactor: change pathTrie per-file to per-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored and fmeum committed Nov 10, 2024
1 parent ccca855 commit 4dc5d65
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions walk/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ func visit(c *config.Config, cexts []config.Configurer, knownDirectives map[stri
}
}

shouldUpdate := updateRels.shouldUpdate(rel, updateParent)

// Filter and collect subdirectories
var subdirs []string
var subdirTries []*pathTrie
for _, t := range trie.children {
base := t.entry.Name()
entRel := path.Join(rel, base)
Expand All @@ -179,14 +180,10 @@ func visit(c *config.Config, cexts []config.Configurer, knownDirectives map[stri
}
if ent := resolveFileInfo(wc, dir, entRel, t.entry); ent != nil {
subdirs = append(subdirs, base)
subdirTries = append(subdirTries, t)
}
}

shouldUpdate := updateRels.shouldUpdate(rel, updateParent)
for i, sub := range subdirs {
if subRel := path.Join(rel, sub); updateRels.shouldVisit(subRel, shouldUpdate) {
visit(c, cexts, knownDirectives, updateRels, subdirTries[i], wf, subRel, shouldUpdate)
if updateRels.shouldVisit(entRel, shouldUpdate) {
visit(c, cexts, knownDirectives, updateRels, t, wf, entRel, shouldUpdate)
}
}
}

Expand Down

0 comments on commit 4dc5d65

Please sign in to comment.