gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

Install documentation problem - interpreted $0 #47

Closed stacyharper closed 6 years ago

stacyharper commented 6 years ago

Hello guys, I recently discovered this framework which is very interesting.

A problem stucked me almost 2h when I tried to install it;

The install doc say :

$ cd /path/to/repo/.git/hooks

$ cat >git-hooks.pl <<EOT
#!/usr/bin/env perl
use Git::Hooks;
run_hook($0, @ARGV);
EOT

$ chmod +x git-hooks.pl

But when the cat command is executed, it created the git-hooks.pl with this content :

#!/usr/bin/env perl
use Git::Hooks;
run_hook(-zsh, @ARGV);

Here you can see that the $0 variable has been interpreted by my bash cat command '-zsh' (which is actualy normal).

For a reason I do not know, the interpreted value "-zsh" make the configured hooks ignored.

When I discovered this, I just replaced "-zsh" by "$0" and hooks are now executed well.

I think you should fix the documentation to take care of different script interpreters.

Have a nice day !

gnustavo commented 6 years ago

Hi Eddie. Thanks for the report. I've just committed a fix to this.

I'm going to cut a new release today which will incorporate the fix.