summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp4bl0 <pablo@rauzy.name>2010-08-08 21:33:01 +0200
committerp4bl0 <pablo@rauzy.name>2010-08-08 21:33:01 +0200
commit8c2153a3e13670e104f3fa59f5badc52ca5f3636 (patch)
tree8e12af0250c818a11b65ae7870d97b9b0f7b14ec
parentb689b42668819df2eb14e0f20271f71539bd1416 (diff)
now detecting template change, regenerating everything in that case
-rw-r--r--html-gen.sh18
1 files changed, 17 insertions, 1 deletions
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" | \