summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-08-10 11:01:29 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-08-10 11:01:38 +0100
commitd0c22665a7a4ddbe2af447a5daf28d51c734ae6a (patch)
treec20198f58a0cea1a710a5116b06896a3f44af270 /bin
parent07cb69c35349fddcc4645754f28adc3218080de0 (diff)
downloadgitano-d0c22665a7a4ddbe2af447a5daf28d51c734ae6a.tar.gz
GITANO: Switch all current hooks (update, post-receive) to use Supple
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-post-receive-hook16
-rw-r--r--bin/gitano-update-hook15
2 files changed, 10 insertions, 21 deletions
diff --git a/bin/gitano-post-receive-hook b/bin/gitano-post-receive-hook
index 01d23d6..9ac4df8 100644
--- a/bin/gitano-post-receive-hook
+++ b/bin/gitano-post-receive-hook
@@ -115,18 +115,12 @@ if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
end
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")
-
- globs["_G"] = globs
- gitano.actions.set_hook_globals(config, repo, globs)
-
- local ok, msg = pcall(fn, repo, updates)
+if repo:uses_hook("post-receive") then
+ gitano.log.info("Running repository post-receive hook")
+ gitano.actions.set_supple_globals("post-receive")
+ local ok, msg = gitano.supple.run_hook(repo, "post-receive", updates)
if not ok then
- gitano.log.crit(msg)
+ gitano.log.crit(msg or "No reason given, but errored somehow.")
end
gitano.log.info("Finished")
end
diff --git a/bin/gitano-update-hook b/bin/gitano-update-hook
index 42588c5..12ac4ac 100644
--- a/bin/gitano-update-hook
+++ b/bin/gitano-update-hook
@@ -246,16 +246,11 @@ if not allow then
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 repo:uses_hook("update") then
+ gitano.log.info("Running repository update hook")
+ gitano.actions.set_supple_globals("update")
+ local ok, msg = gitano.supple.run_hook(repo, "update",
+ refname, oldsha, newsha)
if not ok then
gitano.log.fatal(msg or "No reason given to refuse action.")
end