On Mon, 6 May 2013 05:47:43 -0700 (PDT) Gabby Romano <omerik...@gmail.com> wrote:
> I would like to know if I can tell in any way the specific commit ID > which triggered a post receive hook and pass it on to jenkins. > > I am asking this since we ran into an issue when a commit triggered a > pulling job which in turn, runs "git rev-parse HEAD" to query on the > revision, but until that happened, a new commit was submitted......:-) > is there a way to send the information on the specific commit which > triggered the hook to jenkins instead of running git query command in > the job itself ? The githooks(5) manual page says, that post-receive hooks receive information from Git in the same way pre-receive hooks do, and for that, the manual says: 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> SP <new-value> SP <ref-name> LF Hence, I think if your hook implementation is written using a shell script, you could do #!/bin/sh set -e -u while read _ commit ref; do tell_jenkins $ref $commit done with an accordingly implemented tell_jenkins function. Note that the refname is supposedly something like "refs/heads/master", not just "master". -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.