don't rebuild tags if they were not involved at all

(otherwise posts_with_tags would endlessly freeze)
This commit is contained in:
Alexey Shpakovsky 2014-06-25 06:38:17 +02:00
parent 3c31fd3f60
commit e648b82250

12
bb.sh
View file

@ -408,8 +408,10 @@ edit() {
echo "Posted $filename" echo "Posted $filename"
tags_after="$(tags_in_post $filename)" tags_after="$(tags_in_post $filename)"
relevant_tags="$(echo "$tags_before $tags_after" | tr ' ' '\n' | sort -u | tr '\n' ' ')" relevant_tags="$(echo "$tags_before $tags_after" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
relevant_posts="$(posts_with_tags $relevant_tags) $filename" if [ "$relevant_tags" ]; then
rebuild_tags "$relevant_posts" "$relevant_tags" relevant_posts="$(posts_with_tags $relevant_tags) $filename"
rebuild_tags "$relevant_posts" "$relevant_tags"
fi
} }
# Adds the code needed by the twitter button # Adds the code needed by the twitter button
@ -680,8 +682,10 @@ EOF
chmod 644 "$filename" chmod 644 "$filename"
echo "Posted $filename" echo "Posted $filename"
relevant_tags="$(tags_in_post $filename)" relevant_tags="$(tags_in_post $filename)"
relevant_posts="$(posts_with_tags $relevant_tags) $filename" if [ "$relevant_tags" ]; then
rebuild_tags "$relevant_posts" "$relevant_tags" relevant_posts="$(posts_with_tags $relevant_tags) $filename"
rebuild_tags "$relevant_posts" "$relevant_tags"
fi
} }
# Create an index page with all the posts # Create an index page with all the posts