[PR #3067] [MERGED] Fix ref parsing in commit messages #16743

Closed
opened 2025-11-02 12:18:02 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/3067
Author: @ethantkoenig
Created: 12/2/2017
Status: Merged
Merged: 12/3/2017
Merged by: @lunny

Base: masterHead: fix/parse_commit_message


📝 Commits (2)

  • 08a5d40 Fix ref parsing in commit messages
  • d03c242 Merge branch 'master' into fix/parse_commit_message

📊 Changes

3 files changed (+87 additions, -102 deletions)

View changed files

📝 models/action.go (+57 -70)
📝 models/action_test.go (+30 -0)
📝 models/issue.go (+0 -32)

📄 Description

Fix bug where commit messages containing /# would cause an error, and the rest of the commit message would not be parsed for issue references. This is because GetIndexByRef would return ErrInvalidReference when it encountered /#.

This PR also

  • Improves the regexps for issue refs to avoid superfluous matches (issueReferenceKeywordsPat previously matched every word!)
  • Refactor common code so that it can be reused
  • Adds unit tests for commit message parsing

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/3067 **Author:** [@ethantkoenig](https://github.com/ethantkoenig) **Created:** 12/2/2017 **Status:** ✅ Merged **Merged:** 12/3/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `fix/parse_commit_message` --- ### 📝 Commits (2) - [`08a5d40`](https://github.com/go-gitea/gitea/commit/08a5d403c0ec4a1887bbb93b698fad246eadc6e5) Fix ref parsing in commit messages - [`d03c242`](https://github.com/go-gitea/gitea/commit/d03c24286cc9a1cdb1b070b46d88e3c42bc69437) Merge branch 'master' into fix/parse_commit_message ### 📊 Changes **3 files changed** (+87 additions, -102 deletions) <details> <summary>View changed files</summary> 📝 `models/action.go` (+57 -70) 📝 `models/action_test.go` (+30 -0) 📝 `models/issue.go` (+0 -32) </details> ### 📄 Description Fix bug where commit messages containing `/#` would cause an error, and the rest of the commit message would not be parsed for issue references. This is because `GetIndexByRef` would return `ErrInvalidReference` when it encountered `/#`. This PR also * Improves the regexps for issue refs to avoid superfluous matches (`issueReferenceKeywordsPat` previously matched every word!) * Refactor common code so that it can be reused * Adds unit tests for commit message parsing --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:18:02 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16743