summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2016-06-23 16:59:57 +0200
committerJacob Vosmaer <jacob@gitlab.com>2016-06-23 16:59:57 +0200
commitd5860f45ad21848bbbceeb3823fca2b2820d6cde (patch)
treeb93deea979faf416deeb727a53736a83f46c9726
parentf2325a45c1ce4e6685f61a6e5d1ef0f351e34a18 (diff)
downloadgitlab-shell-d5860f45ad21848bbbceeb3823fca2b2820d6cde.tar.gz
ARGF does more than we want
ARGF is a virtual IO stream that treats the elements of ARGV as paths to files to be opened. In practice, git-receive-pack will probably never pass arguments to pre-receive and post-receive because it is not supposed to (according to 'man 5 githooks'). In case it does, however our hooks should not have the surprise behavior of treating those arguments as files to be opened.
-rwxr-xr-xhooks/post-receive2
-rwxr-xr-xhooks/pre-receive2
2 files changed, 2 insertions, 2 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index da0ff41..34802e5 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -3,7 +3,7 @@
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
-refs = ARGF.read
+refs = $stdin.read
key_id = ENV['GL_ID']
repo_path = Dir.pwd
diff --git a/hooks/pre-receive b/hooks/pre-receive
index 7e23974..1f8a9d5 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -3,7 +3,7 @@
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
-refs = ARGF.read
+refs = $stdin.read
key_id = ENV['GL_ID']
repo_path = Dir.pwd