summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-10 10:00:45 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-10 10:00:45 +0100
commitf9269c16beac2b68f816e4fc67842bfe2ec488bb (patch)
treee481c09efb97c316cd22520d3ebd4312103e85cb /bin
parent76c073bbeb5c8e494155527abba68f29d9cf362f (diff)
downloadgitano-f9269c16beac2b68f816e4fc67842bfe2ec488bb.tar.gz
BIN: Support per-project-repository update hook
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-update-hook20
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/gitano-update-hook b/bin/gitano-update-hook
index 33ecbfe..7fb3dab 100644
--- a/bin/gitano-update-hook
+++ b/bin/gitano-update-hook
@@ -197,8 +197,24 @@ end
gitano.log.ddebug("Ruleset allowed the action, let's run builtin action")
local allow, msg = gitano.actions.update_actions(conf, repo, tags)
if not allow then
- gitano.log.critical("Hooks said:", msg)
- gitano.log.fatal("Hooks denied action. Sorry")
+ gitano.log.critical("Builtin actions said:", msg)
+ gitano.log.fatal("Actions denied action. Sorry")
+end
+
+local fn, globs = repo:load_hook("update-hook")
+if not fn then
+ gitano.log.crit(globs)
+elseif fn ~= true then
+ gitano.log.info("Running project-repository update hook")
+
+ globs["_G"] = globs
+ gitano.actions.set_hook_globals(config, repo, globs)
+
+ local ok, msg = pcall(fn, repo, refname, oldsha, newsha)
+ if not ok then
+ gitano.log.fatal(msg or "No reason given to refuse action.")
+ end
+ gitano.log.info("Finished")
end
gitano.log.info("Allowing ref update of",