diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/gitano-post-receive-hook | 26 |
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 |