diff options
author | Gavin Lee <gavlee888@live.ie> | 2014-05-16 18:07:57 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2014-05-16 18:08:21 +0100 |
commit | afec65a4de6cecdeb005c6a2757e0aad7bccf98d (patch) | |
tree | a5a75357b6e899021627fa8862afa88aa4947a3d | |
parent | f010726f585dc15f71673ca4be749757e9ed10cb (diff) | |
download | gitano-afec65a4de6cecdeb005c6a2757e0aad7bccf98d.tar.gz |
Short-circuiting hooks if repository is accessed directly
Signed-off-by: Vanush "Misha" Paturyan <misha@cs.nuim.ie>
-rw-r--r-- | bin/gitano-post-receive-hook.in | 6 | ||||
-rw-r--r-- | bin/gitano-pre-receive-hook.in | 6 | ||||
-rw-r--r-- | bin/gitano-update-hook.in | 6 | ||||
-rw-r--r-- | lib/gitano/auth.lua | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/bin/gitano-post-receive-hook.in b/bin/gitano-post-receive-hook.in index 3dccfee..df42ffc 100644 --- a/bin/gitano-post-receive-hook.in +++ b/bin/gitano-post-receive-hook.in @@ -31,6 +31,12 @@ local username = luxio.getenv("GITANO_USER") or "gitano/anonymous" local keytag = luxio.getenv("GITANO_KEYTAG") or "unknown" local project = luxio.getenv("GITANO_PROJECT") or "" local source = luxio.getenv("GITANO_SOURCE") or "ssh" +local running = luxio.getenv("GITANO_RUNNING") + +-- Check whether we are called through gitano-auth +if not running then + return 0 +end -- Now load the administration data gitano.config.repo_path(repo_root) diff --git a/bin/gitano-pre-receive-hook.in b/bin/gitano-pre-receive-hook.in index 182554b..2d9ef7e 100644 --- a/bin/gitano-pre-receive-hook.in +++ b/bin/gitano-pre-receive-hook.in @@ -31,6 +31,12 @@ local username = luxio.getenv("GITANO_USER") or "gitano/anonymous" local keytag = luxio.getenv("GITANO_KEYTAG") or "unknown" local project = luxio.getenv("GITANO_PROJECT") or "" local source = luxio.getenv("GITANO_SOURCE") or "ssh" +local running = luxio.getenv("GITANO_RUNNING") + +-- Check whether we are called through gitano-auth +if not running then + return 0 +end -- Now load the administration data gitano.config.repo_path(repo_root) diff --git a/bin/gitano-update-hook.in b/bin/gitano-update-hook.in index bb7d8fe..15da2a9 100644 --- a/bin/gitano-update-hook.in +++ b/bin/gitano-update-hook.in @@ -35,6 +35,12 @@ local username = luxio.getenv("GITANO_USER") or "gitano/anonymous" local keytag = luxio.getenv("GITANO_KEYTAG") or "unknown" local project = luxio.getenv("GITANO_PROJECT") or "" local source = luxio.getenv("GITANO_SOURCE") or "ssh" +local running = luxio.getenv("GITANO_RUNNING") + +-- Check whether we are called through gitano-auth +if not running then + return 0 +end -- Now load the administration data gitano.config.repo_path(repo_root) diff --git a/lib/gitano/auth.lua b/lib/gitano/auth.lua index 2e275dd..fa30da2 100644 --- a/lib/gitano/auth.lua +++ b/lib/gitano/auth.lua @@ -40,6 +40,7 @@ local function set_environment(repo_root, repo, context, transactionid) ["GITANO_PROJECT"] = (repo or {}).name or "", ["GITANO_SOURCE"] = context.source, ["GITANO_TRANSACTION_ID"] = transactionid, + ["GITANO_RUNNING"] = "yes", } for k, v in pairs(env) do |