Skip to content

Commit

Permalink
fix(commit-msg): pattern should be only checked in uncommented text
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Tauchnitz committed Nov 4, 2024
1 parent d1a1d97 commit 6e2f3ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions giticket/giticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
def update_commit_message(filename, regex, mode, format_string):
with io.open(filename, 'r+') as fd:
contents = fd.readlines()
commit_msg = contents[0].rstrip('\r\n')
commit_msg = [line for line in contents if not line.startswith('#')]
# Check if we can grab ticket info from branch name.
branch = get_branch_name()

# Bail if commit message already contains tickets
if any(re.search(regex, content) for content in contents):
if any(re.search(regex, commit_msg_line) for commit_msg_line in commit_msg):
return

tickets = re.findall(regex, branch)
Expand Down

0 comments on commit 6e2f3ed

Please sign in to comment.