Skip to content

Commit

Permalink
Add issue key to commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lsorber authored May 7, 2019
1 parent 4b2b9bf commit 1a2757f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def main():
jira_issue_key = extract_jira_issue_key(git_branch_name)
if not jira_issue_key:
exit_with_error(
f'Commit aborted! To continue, please rename your branch to a Jira'
f'Commit aborted! To continue, please rename your branch to a Jira '
f'issue key with:\n$ git branch -m {git_branch_name} <KEY-123>')
# Read the commit message.
commit_msg_filepath = sys.argv[1]
Expand All @@ -114,14 +114,14 @@ def main():
# Build the new commit message:
# 1. If there is a body, turn it into a comment on the issue.
if '#comment' not in commit_msg and commit_body:
commit_body = f'Jira #comment {commit_body}'
commit_body = f'{jira_issue_key} #comment {commit_body}'
# 2. Add the time worked to the Work Log in the commit body.
if '#time' not in commit_msg:
if 'Open the pod bay doors' in commit_subject:
log = 'Open the pod bay doors'
else:
log = commit_subject
log = f'Jira #time {time_worked_on_commit()} {log}'
log = f'{jira_issue_key} #time {time_worked_on_commit()} {log}'
commit_body = f'{commit_body}\n\n{log}' if commit_body else log
# 3. Make sure the subject starts with a Jira issue key.
if not extract_jira_issue_key(commit_subject):
Expand Down

0 comments on commit 1a2757f

Please sign in to comment.