Modification : vm_{host,hosted,remote} -> {host,local,remote}/ .
[lhc/ateliers.git] / host / git-configure
diff --git a/host/git-configure b/host/git-configure
new file mode 100755 (executable)
index 0000000..a56d788
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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