4
我在githook commit-msg
中使用这个脚本。如何在Git Tower中获得Git Commit消息?
#!/usr/bin/python
import sys
import re
ret = 1
try:
with open(sys.argv[1]) as msg:
res = re.match("^fix gh-[0-9]+.*$", msg.readline())
if res != None:
ret = 0
except:
pass
if (ret != 0):
print("Wrong commit message. Example: 'fix gh-1234 foo bar'")
sys.exit(ret)
问题是Git Tower似乎没有在argv
中包含任何参数。如何解决这个问题,我可以像Git Tower那样在命令行中使用git?
这是SmartGit和其他GUI工具也是一个问题。 – prabodhprakash
这听起来像是Git Tower中的一个bug,因为你的钩子看起来很好。因为[他们声称钩子应该工作](https://www.git-tower.com/help/mac/faq-and-tips/faq/hook-scripts)(虽然,信息应该打印到stderr),我请联系[Git Tower支持](https://www.git-tower.com/support/contact)。 – Hasturkun
检查,联系支持团队 –