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

@@ -277,7 +277,7 @@ func (h *HugoSites) assemble(ctx context.Context, l logg.LevelLogger, bcfg *Buil
changes := assembleChanges.Changes()
// Changes from the assemble step (e.g. lastMod, cascase) needs a re-calculation
// Changes from the assemble step (e.g. lastMod, cascade) needs a re-calculation
// of what needs to be re-built.
if len(changes) > 0 {
if err := h.resolveAndClearStateForIdentities(ctx, l, nil, changes); err != nil {
@@ -598,6 +598,10 @@ type pathChange struct {
isDir bool
}
func (p pathChange) isStructuralChange() bool {
return p.delete || p.isDir
}
// processPartial prepares the Sites' sources for a partial rebuild.
func (h *HugoSites) processPartial(ctx context.Context, l logg.LevelLogger, config *BuildCfg, init func(config *BuildCfg) error, events []fsnotify.Event) error {
h.Log.Trace(logg.StringFunc(func() string {