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 su开发者_如何学Pythonccess.
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:
while (<>) {
   chomp;
   next unless my($old,$new,$ref) =
      m/ ^ ([0-9a-f]+) \s+    # old SHA-1
           ([0-9a-f]+) \s+    # new SHA-1
           refs\/heads\/(.*?) # ref
         \s* $ /x;
   #...
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论