用perl编写的post-receive钩子如何获取分支名称?
我有一个用 perl 编写的 post-receive 钩子。我需要能够弄清楚正在推送到哪个分支。我该怎么做?我尝试查看 @ARGV 和 $ARGV[2] 但没有成功。
I have a post-receive hook that is written in perl. I need to be able to figure out which branch is being pushed to. How can I do this? I tried looking at @ARGV and $ARGV[2] without success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git 文档中的关键是 post-receive 挂钩不接收任何参数:
该挂钩针对接收操作执行一次。它不带任何参数,但获取与 <> 相同的信息。 hook 在其标准输入上执行操作。
这是我用来解析 ref 的一些 Perl 代码:
The key from the git documentation is that the post-receive hook receives no arguments:
This hook executes once for the receive operation. It takes no arguments, but gets the same information as the <> hook does on its standard input.
Here is some perl code that I have used to parse ref: