#!/bin/sh -eu tool=$(readlink -e "${0%/*}/..") . "$tool"/host/lib.sh cd "$tool" git config --replace branch.master.remote . git config --replace branch.master.merge refs/remotes/master local tool tool=$(cd "$tool"; cd -) install -m 770 /dev/stdin \ .git/hooks/post-update <<-EOF #!/bin/sh -efux case \$1 in (refs/remotes/master) cd .. #git --git-dir=\$PWD/.git checkout -f -B master remotes/master && git --git-dir=\$PWD/.git checkout HEAD'^' && git --git-dir=\$PWD/.git branch -f master remotes/master && git --git-dir=\$PWD/.git checkout master git --git-dir=\$PWD/.git clean -f -d -x ;; esac EOF