]> git.phdru.name Git - git-scripts.git/commitdiff
Add post-update to update git-scripts after pushing to git-scripts.git
authorOleg Broytman <phd@phdru.name>
Fri, 28 Sep 2018 15:05:54 +0000 (18:05 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 28 Sep 2018 15:08:43 +0000 (18:08 +0300)
hooks/post-update [new file with mode: 0755]

diff --git a/hooks/post-update b/hooks/post-update
new file mode 100755 (executable)
index 0000000..45de97e
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Update git-scripts after pushing to master at git-scripts.git.
+# This hook must be in git-scripts.git/hooks/post-update.
+
+for ref in "$@"; do
+   if [ "$ref" = refs/heads/master ]; then
+      unset GIT_DIR
+      cd ../git-scripts &&
+      exec git pull ../git-scripts.git master
+   fi
+done