Describe configurable custom hooks in sample hooks
[gitorious:sirfabios-mainline.git] / data / hooks / custom-pre-receive.sample
1 #!/usr/bin/env ruby
2
3 # Custom pre-receive hook
4 # -----------------------
5
6 # Enable by renaming from custom-pre-receive.sample to
7 # custom-pre-receive. Once renamed, it can be customized freely and is
8 # not version controlled. Content of this script can be changed to
9 # regular shellscript, no need to be ruby code.
10
11 # Alternatively, enable custom pre-receive hook by configuring the
12 # path to an executable script in gitorious.yml:
13 #
14 # custom_pre_receive_hook: /my/hook
15
16 # Called at the end of the standard Gitorious pre-receive hook. Like
17 # the regular pre-receive hook, the custom pre-receive hook receives
18 # pushed references on stdin, one line per pushed reference.
19
20 # Example: pushing 'master' and 'testbranch' will pass something like
21 # this to stdin
22 #
23 # remote: b506db4d7520f0257dfe389ab729fa0976ced289 1cbd892e83f597cb6c33a53a45c38a1ba6bbef27 refs/heads/master
24 # remote: 5577de353b5799f4c7bd65561b630c4cc8eb4b1c 19df9a1b5c973b004f23f7989ce2773ba638acd9 refs/heads/testbranch
25
26 # Anything written to stdout (e.g 'puts("foo")') and stderr will be
27 # passed back over the line to the user who started the git push.
28
29 # exit!(EXITCODE), or raising exceptions will cause the push operation
30 # to fail immediately.
31
32 # More on the "pre-receive", "post-receive" and "update" serverside hooks:
33 # http://git-scm.com/book/en/Customizing-Git-Git-Hooks#Server-Side-Hooks
34
35 puts "[DEBUG] CUSTOM PRE-RECEIVE HOOK STARTS"
36
37 puts "[DEBUG] REFERENCES PUSHED:"
38 while data = gets
39   puts data # writes each pushed reference to stdout
40 end
41
42 puts "[DEBUG] CUSTOM PRE-RECEIVE HOOK ENDS"