From 8c2153a3e13670e104f3fa59f5badc52ca5f3636 Mon Sep 17 00:00:00 2001 From: p4bl0 Date: Sun, 8 Aug 2010 21:33:01 +0200 Subject: now detecting template change, regenerating everything in that case --- html-gen.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/html-gen.sh b/html-gen.sh index eb26772..955f86a 100644 --- a/html-gen.sh +++ b/html-gen.sh @@ -9,6 +9,22 @@ if [ ! -d "$public_dir" ]; then mkdir -p "$public_dir"; fi articles_dir=`git config --get fugitive.articles-dir` preproc=`git config --get fugitive.preproc` +tpl_change=`echo "$added_files" "$modified_files" "$deleted_files" | \ + grep -c "$templates_dir/"` +if [ "$tpl_change" -gt 0 ]; then + added_files= + modified_files=`git log --name-status --pretty="format:" | \ + grep -E '^A' | cut -f2 | sort | uniq` + deleted_files= + tmpart=`mktemp --suffix "-fugitive"` + tmpmod=`mktemp --suffix "-fugitive"` + ls "$articles_dir"/* > "$tmpart" + echo "$modified_files" | tr " " "\n" > "$tmpmod" + modified_files=`comm -12 --nocheck-order "$tmpmod" "$tmpart"` + rm "$tmpart" "$tmpmod" + echo "[fugitive] Templates changed, regenerating everything..." +fi + generated_files=`mktemp --suffix "-fugitive"` articles_sorted=`mktemp --suffix "-fugitive"` @@ -151,7 +167,7 @@ replace_commit_info() { commit_subject=`get_commit_info "%s" "$1"` commit_slug=`get_commit_info "%f" "$1"` commit_body=`get_commit_body "$1"` - + replace_str "commit_Hash" "$commit_Hash" | \ replace_str "commit_hash" "$commit_hash" | \ replace_str "commit_author" "$commit_author" | \ -- cgit v1.2.3