summaryrefslogtreecommitdiff
path: root/lib/notes.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-15 14:14:32 +0200
committerPaul Buetow <paul@buetow.org>2026-02-15 14:14:45 +0200
commit00e5de525bde5d0d77d9553c6126908f2fdfde20 (patch)
tree0686bc72be5f7a5bc5fd18f5dcdd6d0cfb868ac3 /lib/notes.source.sh
parente6aa888599062843409d037b4007be43ef3b0f02 (diff)
Improve --generate performance with incremental builds (62s -> 2s)
Add mtime-based skip logic to avoid regenerating unchanged files: - generate::fromgmi skips .gmi files where all outputs are newer - template::_generate_file skips templates when output is fresh - Diff-before-overwrite in templates, gemfeed, and notes indexes to preserve mtimes and prevent cascading cache invalidation - Global dependency check (.lastgen sentinel) for header/footer/CSS - Job throttling via wait -n capped at nproc cores - Add --force flag and FORCE_REBUILD env var to bypass skip logic - Fix misleading atom feed "empty cache" log message Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'lib/notes.source.sh')
-rw-r--r--lib/notes.source.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/notes.source.sh b/lib/notes.source.sh
index bdea5fc..85bd2b5 100644
--- a/lib/notes.source.sh
+++ b/lib/notes.source.sh
@@ -41,5 +41,10 @@ That were all notes. Hope they were useful!
=> ../ Go back to main site
NOTES
- mv "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi"
+ # Only overwrite if content changed, preserving mtime for template skip logic
+ if [[ -f "$notes_dir/index.gmi" ]] && diff -q "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi" >/dev/null 2>&1; then
+ rm "$notes_dir/index.gmi.tmp"
+ else
+ mv "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi"
+ fi
}