I am using this script in the githook commit-msg
.
#!/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)
The problem is that Git Tower doesn't seem to include any arguments inside argv
. How to solve this in a way that I can use git both from the command line as in a GUI like Git Tower?