While playing around with some hooks I noticed that the output from the hooks invoked when pushing to a remote repository are subtly different:
hooks/pre-receive
stdin: [[old-value new-value ref-name]]
hooks/update ref-name old-value new-value
hooks/post-receive
stdin: [[old-value new-value ref-name]]
hooks/post-update ref-name
Where:
- *value: a commit hash
- ref-name: for example, refs/heads/master
The format of the information the hooks receive is not consistent, but of particular interest to this question is that pre and post receive can accept multiple updated refs via standard input. The docs say:
This hook executes once for the receive operation. It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:
old-value new-value ref-name
Therefore, under what circumstances would these hooks receive multiple values?
Pushing multiple branch/tag will generate multiple values. You can do commands like: