开发者

need to parse refname in post-receive script

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜