summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2017-08-01 16:22:09 +0100
committerRichard Maw <richard.maw@gmail.com>2017-08-01 16:22:09 +0100
commitea45bb9535fceea9c9feebde0360c594fc985fe1 (patch)
tree5ab3d6ebc1b2efe5cac2020cd9e089570245d361 /bin
parenta44c0319c286c526f489122b785c89bbf5845782 (diff)
downloadgitano-ea45bb9535fceea9c9feebde0360c594fc985fe1.tar.gz
Move post-push dangling-HEAD check to post-receive hook
The smart-http interface starts http-backend which calls receive-pack. Unfortunately we were performing the dangling-HEAD check after calling receive-pack ourselves, so when using smart-http we weren't performing the check. By moving this into the post-receive hook the check can be performed in smart-http too.
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-post-receive-hook.in11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/gitano-post-receive-hook.in b/bin/gitano-post-receive-hook.in
index cb77e06..61df35c 100644
--- a/bin/gitano-post-receive-hook.in
+++ b/bin/gitano-post-receive-hook.in
@@ -213,9 +213,20 @@ function post_receive_run_supple(repo, updates)
return "continue"
end
+function post_receive_check_head(repo, updates)
+ -- Check that HEAD is now resolvable in the repo
+ if not repo.git:get("HEAD") then
+ gitano.log.warn("")
+ gitano.log.warn(gitano.i18n.expand("WARN_HEAD_DANGLING"))
+ gitano.log.warn("")
+ end
+ return "continue"
+end
+
gitano.hooks.add(gitano.hooks.names.POST_RECEIVE, -1000,
post_receive_core_handler)
gitano.hooks.add(gitano.hooks.names.POST_RECEIVE, 0, post_receive_run_supple)
+gitano.hooks.add(gitano.hooks.names.POST_RECEIVE, 1000, post_receive_check_head)
gitano.hooks.run(gitano.hooks.names.POST_RECEIVE, repo, updates)