Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: blmayer (bleemayer@gmail.com)
Date: Wed Oct 4 02:34:26 2023 -0300
Parent: 747265e
Improved op check
diff --git a/post-receive b/post-receive
index 83d0a3c..0914afc 100755
--- a/post-receive
+++ b/post-receive
@@ -209,11 +209,9 @@ updatetree() {
<tr><th>Size</th><th>Name</th><th>Raw</th></tr>
EOF
- # (cd "$OUT/tree" && find * -type f -printf '%s %p\n') | while read -r s f
- git show --format='' --name-status "$1" | while read -r op f
+ (cd "$OUT/tree" && find * -type f -printf '%s %p\n') | while read -r s f
do
echo "updating file $f"
- [ "$op" = "D" ] && rm "$OUT/tree/$f.html"; continue
cat <<- EOF >> "$OUT/tree.html"
<tr>
@@ -224,7 +222,12 @@ updatetree() {
EOF
# create html page with file content
- filepage "$f" > "$OUT/tree/$f.html"
+ git show --format='' --name-status "$1" "$f" | read -r op x
+ case "$op" in
+ "D") rm "$OUT/tree/$f.html"; continue ;;
+ "C"|"M") filepage "$f" > "$OUT/tree/$f.html" ;;
+ "") continue ;;
+ esac
done
cat <<- EOF >> "$OUT/tree.html"