19 lines
634 B
Bash
Executable File
19 lines
634 B
Bash
Executable File
#!/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
|