summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-03 14:07:59 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-03 14:07:59 +0100
commit8daeffafc008acf123613e5b7ac8725521891d29 (patch)
treeb4ff2e653a4c3ac9fac30794c187b26215c5e212 /bin
parent3cbd2cc5039dc6d14a88d9e374b7109500a3e27b (diff)
downloadgitano-8daeffafc008acf123613e5b7ac8725521891d29.tar.gz
Support the post-receive hook
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-post-receive-hook26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/gitano-post-receive-hook b/bin/gitano-post-receive-hook
index 7cb099e..46ca83b 100644
--- a/bin/gitano-post-receive-hook
+++ b/bin/gitano-post-receive-hook
@@ -107,4 +107,30 @@ if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
gitano.log.chat("All repositories updated where possible.")
end
+local fn, globs = repo:load_hook("post-receive")
+if not fn then
+ gitano.log.crit(globs)
+elseif fn ~= true then
+ gitano.log.info("Running project-repository post-receive hook")
+ for _, k in ipairs({ "table", "string", "pairs", "ipairs", "pcall",
+ "xpcall", "unpack", "tostring", "tonumber", "math",
+ "type", "coroutine", "select", "error", "assert" }) do
+ globs[k] = _G[k]
+ end
+ local logcopy = {}
+
+ for _, k in pairs({ "state", "crit", "critical", "err", "error", "warn",
+ "warning", "chat", "info", "debug", "ddebug",
+ "deepdebug" }) do
+ logcopy[k] = gitano.log[k]
+ end
+ globs["log"] = logcopy
+ globs["_G"] = globs
+ local ok, msg = pcall(fn, repo, updates)
+ if not ok then
+ gitano.log.crit(msg)
+ end
+ gitano.log.info("Finished")
+end
+
return 0