开发者

need to parse refname in post-receive script

开发者 https://www.devze.com 2023-02-22 19:18 出处:网络
In my post-receive hook, I would like to get the branch the user is committing on, store in a variable, and pass it to a web service (Hudson build system).Can I use the refname passed into STDIN for t

In my post-receive hook, I would like to get the branch the user is committing on, store in a variable, and pass it to a web service (Hudson build system). Can I use the refname passed into STDIN for this? If so, how do I get it? I've tried $3, but this doesn't seem to work.

Also, adding the line

echo $3
开发者_Python百科

shows just a blank.

Thanks!


Yes, you probably want the one(s) from STDIN. There may be more than one.

If you don't want to convert your script you can do

test -z "$1" && while read a b c ; do "$0" "$a" "$b" $c" ; done

instead, to have it process STDIN running self with input as arguments.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号