From cdedb85934c3fb666e14adfaf9da265952a5842f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 19 Feb 2013 19:16:55 -0500 Subject: [PATCH] Fix post-receive hook arguments issues and document the setup. (imported from commit 0440cbc97337b8dd9f92bbbd428a069f79df400a) --- bots/githook-post-receive | 1 + tools/post-receive | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 120000 bots/githook-post-receive diff --git a/bots/githook-post-receive b/bots/githook-post-receive new file mode 120000 index 0000000000..3c91ebad97 --- /dev/null +++ b/bots/githook-post-receive @@ -0,0 +1 @@ +../api/integrations/git/post-receive \ No newline at end of file diff --git a/tools/post-receive b/tools/post-receive index 27eeed2b43..eb7be859e6 100755 --- a/tools/post-receive +++ b/tools/post-receive @@ -7,6 +7,18 @@ # # ssh humbug@git.humbughq.com 'cd humbug; git pull' # +# To send the Humbug notices, this script calls out to our +# for-distribution git hook (under api/integrations/); since the git +# hook needs to be in the same directory as the configuration script +# for the git hook, this means that we need to have a shared directory +# containing (a symlink to) both the the for-distribution git hook and +# the Humbug configuration; for the moment those are +# bots/githook-post-receive and bots/humbug_git_config.py, +# respectively. We need the intermediate symlink because the git hook +# looks for its configuration in the directory that it sits in, and +# api/integrations/git/ has the example configuration. +# +# # The "post-receive" script is run after receive-pack has accepted a pack # and the repository has been updated. It is passed arguments in through # stdin in the form @@ -49,7 +61,7 @@ for ln in sys.stdin: oldrev, newrev, refname = ln.strip().split() if refname in deployments: (server, branch) = deployments[refname] - p = subprocess.Popen("/home/humbug/humbug/api/integrations/git/post-receive", + p = subprocess.Popen("/home/humbug/humbug/bots/githook-post-receive", stdin=subprocess.PIPE) p.communicate(input=ln) - update_deployment(server, oldrev, newrev, branch) + update_deployment(server, oldrev, newrev, "origin/" + branch)