Skip to content

fix: skip prepending issue number if already in commit message#24

Merged
SethPaul merged 1 commit into
mainfrom
gh_23-duplicates_in_message
Jan 24, 2026
Merged

fix: skip prepending issue number if already in commit message#24
SethPaul merged 1 commit into
mainfrom
gh_23-duplicates_in_message

Conversation

@SethPaul
Copy link
Copy Markdown
Collaborator

@SethPaul SethPaul commented Jan 24, 2026

Summary

  • Fixes duplicate issue number prepending when commit message already contains the issue reference
  • Adds regex check to detect existing #ISSUE_NUMBER pattern before prepending

Test plan

  • Verified pre-commit hook passes
  • Test with commit that already has issue number in message
  • Test with commit that doesn't have issue number

Closes #23

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where commit message issue number prepends could create duplicates. The system now checks for existing issue numbers before prepending to prevent duplication.

✏️ Tip: You can customize this high-level summary in your review settings.

…events duplicate issue references when the commit message already contains the issue number. Session: claude -r b8e8e632-92dc-4b21-b2ea-fa6c1d3da437
@SethPaul SethPaul merged commit 26d8968 into main Jan 24, 2026
1 of 2 checks passed
@SethPaul SethPaul deleted the gh_23-duplicates_in_message branch January 24, 2026 00:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 24, 2026

Walkthrough

The script commit_msg_issue_number_prepend.sh is modified to prevent duplicate issue numbers in commit messages. It now reads the current commit message into a variable, checks if the issue number is already present using regex pattern matching, and exits early if found before prepending the issue number.

Changes

Cohort / File(s) Summary
Duplicate Issue Number Prevention
commit_msg_issue_number_prepend.sh
Added regex check to detect if issue number is already present in the commit message before prepending. Introduced early exit logic to avoid duplicates. Replaced backtick command substitution with variable assignment for safer message handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding logic to skip prepending issue numbers when already present in the commit message.
Linked Issues check ✅ Passed The PR successfully addresses issue #23 by implementing a regex check to detect and prevent duplicate issue number prepending in commit messages.
Out of Scope Changes check ✅ Passed All changes in commit_msg_issue_number_prepend.sh are directly related to fixing duplicate issue number prepending, with no out-of-scope modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

duplicate issue numbers

1 participant