Skip to content

Conversation

@lchojnacki
Copy link

Current behavior:

When the --format argument starts with #{ticket}, during git commit --amend --no-edit an additional task number was added at the beginning.

Expected behavior:

When the commit message starts with #{ticket} (only on the first line), do not add it again.

Fix applied:

Skip the line starting with # only if it is not the first line.

@lchojnacki lchojnacki self-assigned this Nov 6, 2024
@lchojnacki lchojnacki requested a review from nekeal November 6, 2024 16:54
Comment on lines 20 to 24
def is_ticket_in_message(contents, ticket):
for line in contents.splitlines():
for i, line in enumerate(contents.splitlines()):
stripped = line.strip().lower()

if stripped == "" or stripped.startswith("#"):
if stripped == "" or (stripped.startswith("#") and i != 0):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a docstring 😁

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants