[英]Git hooks in PHPStorm on Mac
I've got problem with commiting in PHPStorm with pre-commit
hook enabled. 我在启用
pre-commit
挂钩的情况下在PHPStorm中pre-commit
遇到问题。
#!/bin/sh
cd "$(git rev-parse --show-toplevel)"
# Message
message () {
if [ $2 -ne 0 ]
then
echo "${1}: Error"
exit 1
else
echo "${1}: Success"
fi
}
# JSHint
grunt lint:js &> /dev/null
message "JSHint" $?
# Unit tests
grunt test:unit:frontend &> /dev/null
message "Unit tests" $?
Code is pretty simple, it just fire Grunt tasks one by one and show short message for commit that it failed or not. 代码非常简单,它只会一步一步地启动Grunt任务,并显示一条简短的提交失败或失败的消息。
The problem is that when I run it in terminal - it works correctly, when I try to run it in PHPStorm I get information grunt: command not found
. 问题是,当我在终端中运行它时,它可以正常工作,当我尝试在PHPStorm中运行它时,我会收到信息
grunt: command not found
。
It occurs only on Mac, as I tried on Ubuntu and it works. 正如我在Ubuntu上尝试的那样,它仅在Mac上发生,并且可以正常工作。 Also I tested which user is running this script with
whoami
and it's the same user which is logged in. 我还测试了哪个用户正在使用
whoami
运行此脚本,并且该用户是登录的同一用户。
Do you have any ideas what's wrong, or maybe someone just had same issue? 您有什么想法怎么了,或者有人刚遇到过同样的问题?
Thanks in advance for help. 在此先感谢您的帮助。
IDEA-134108已修复,该修复应在下一个PHPStorm版本中可用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.