]> gitweb.fluxo.info Git - hydra.git/commitdiff
Adds a post-receive hook
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 26 Jan 2017 12:43:56 +0000 (10:43 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 26 Jan 2017 12:43:56 +0000 (10:43 -0200)
lib/hydra/hooks/post-receive [new file with mode: 0755]
share/hydractl/sync-media-export

diff --git a/lib/hydra/hooks/post-receive b/lib/hydra/hooks/post-receive
new file mode 100755 (executable)
index 0000000..ff7cf50
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Post-receive git hook
+#
+
+cd ..
+unset GIT_DIR
+
+if [ -d ".git/annex" ]; then
+  git annex sync
+else
+  git config receive.denyCurrentBranch ignore
+  #git reset HEAD
+  git checkout -f
+fi
+
+git submodule update --init --recursive
+
+cd -
+exec git update-server-info
index 5c5630dd2e96abede941268362101f0859185cfd..8cf44cbc7846b88a3df852bd1b0e7ccd1a9baf0f 100755 (executable)
@@ -30,8 +30,10 @@ for file in `ls $MEDIA`; do
         continue;
       fi
 
+      # If remote destination, add a git post-receive hook
       if [ -d "$file/.git" ]; then
         git clone $file $file.git && \
+          cp -a $APP_BASE/lib/hydra/hooks/post-receive $file.git/.git/hooks/post-receive && \
           rsync -avz $file.git/ $DESTINATION:/var/cache/media/$file/ && \
           rm -rf $file.git
       else