Fix rebuilds on cascade deletes/renames

And also avoid reading sub directories on simple changes to branch `_index.md` files.

Fixes #12449
This commit is contained in:
Bjørn Erik Pedersen
2024-05-01 10:01:25 +02:00
parent c8e400b621
commit 7be7f89bf6
5 changed files with 64 additions and 5 deletions

View File

@@ -147,7 +147,7 @@ func (c *pagesCollector) Collect() (collectErr error) {
false,
func(fim hugofs.FileMetaInfo) bool {
if fim.IsDir() {
return true
return id.isStructuralChange()
}
fimp := fim.Meta().PathInfo
if fimp == nil {
@@ -160,7 +160,7 @@ func (c *pagesCollector) Collect() (collectErr error) {
} else {
// We always start from a directory.
collectErr = c.collectDir(id.p, id.isDir, func(fim hugofs.FileMetaInfo) bool {
if id.delete || id.isDir {
if id.isStructuralChange() {
if id.isDir && fim.Meta().PathInfo.IsLeafBundle() {
return strings.HasPrefix(fim.Meta().PathInfo.Path(), paths.AddTrailingSlash(id.p.Path()))
}