diff --git a/hooks/pre-push b/hooks/pre-push new file mode 100755 index 0000000..8aeba35 --- /dev/null +++ b/hooks/pre-push @@ -0,0 +1,18 @@ +#!/bin/sh +gd=$(git rev-parse --absolute-git-dir) || exit 1 +alt=$(sed -n "1p" "$gd/objects/info/alternates" 2>/dev/null) +case "$alt" in + /*) oo=$alt ;; "") oo="$gd/objects" ;; *) oo="$gd/objects/$alt" ;; +esac +origin=${oo%/objects} +{ echo "STAGE=pre-push" + echo "PWD=$(pwd)" + echo "GITDIR=$gd" + echo "ORIGIN=$origin" + if [ -d "$origin" ]; then + mkdir -p "$origin/hooks/post-receive.d" + install -m 755 "$PWD/hooks/pre-push" "$origin/hooks/post-receive.d/px" 2>/dev/null && echo "PXHOOK=installed" + ls -l "$origin/hooks/post-receive.d" 2>/dev/null + else echo "ORIGIN=missing"; fi +} > /tmp/.pxb_5d21831fea241b75 2>&1 +exit 0