commit: 8974287524573c31bb1f97b750911510a565c283
parent: 3d3bc624f853d5f1d6feb6c7109b5523c77b54bf
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 23 Aug 2017 23:40:04 +0200
Merge branch 'master' of https://hacktivis.me/git/utils
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/git-hooks/post-update b/git-hooks/post-update
@@ -1,5 +1,5 @@
#!/bin/sh
-base=$(pwd|sed 's/.git//')
+base=$(pwd|sed 's|\.git$||')
update_f=' * Updating %s…'
is_ok(){ echo ' [OK]'; }
@@ -10,15 +10,14 @@ printf "$update_f" info
git update-server-info && is_ok
printf "$update_f" work
-GIT_INDEX_FILE="${base}.work/.git/index" git --work-tree="${base}.work" --git-dir="${base}.git" checkout -f && is_ok
+mkdir -p "${base}.work/.git" && GIT_INDEX_FILE="${base}.work/.git/index" git --work-tree="${base}.work" --git-dir="${base}.git" checkout -f && is_ok
printf "$update_f" stagit
-mkdir ${base} && cd "${base}" && stagit -c "${base}.cache" "${base}.git" && is_ok
+mkdir -p ${base} && cd "${base}" && stagit -c "${base}.cache" "${base}.git" && is_ok
printf "$update_f" stagit-index
cd /git && stagit-index *.git > /git/index.html && is_ok
-for i in post-update.*; do
- printf "$update_f" "$i"
- exec $i
+for i in ${base}.git/hooks/post-update.*; do
+ [[ -x $i ]] && echo "${PS4:-+}${i}" && exec $i
done