From b447c78b8f5864d33f7f6f53518197c34b58ee3e Mon Sep 17 00:00:00 2001 From: Ulrich Huber Date: Fri, 20 Dec 2024 14:22:31 +0100 Subject: [PATCH] Lift requirement for Issue-Ref in commit message Commits are linked by Github to the PR that introduced them. It is impossible to merge a commit without PR. Hence, it is sufficient if the PR links to issues. We have no tooling that would verify that the linkage of a commit is correct. Thus, making an issue reference in the commit message mandatory holds no benefit. It is still allowed to reference an issue in a commit message. It is simply no longer mandatory. Issue-ref: closes #131 Issue-ref: closes #119 --- .gitlint | 5 ----- docs/process/guidelines/git/index.rst | 27 +++++++++++---------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.gitlint b/.gitlint index 53a3c5c..34bc333 100644 --- a/.gitlint +++ b/.gitlint @@ -32,11 +32,6 @@ regex=^[a-z_-]+: .+$ # First line of the commit message body must be empty. (second line of the commit message) [body-first-line-empty] -# Body must contain a reference to an issue -# 'see' will act as a form of reference from commits to issues without closing them. -[body-match-regex] -regex=Issue-ref: (see|close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) #(\d+) - #Ignores the title if it starts with Revert or Merge [ignore-by-title] regex=(^Revert |^Merge ) diff --git a/docs/process/guidelines/git/index.rst b/docs/process/guidelines/git/index.rst index 4f75c42..3712e33 100644 --- a/docs/process/guidelines/git/index.rst +++ b/docs/process/guidelines/git/index.rst @@ -107,28 +107,24 @@ If feasible, the commit message body should be extended with quoted material such as compiler warnings, debugger stack traces or measurement data for performance optimizations. +The description may mention issues and link to them. A detailed description +of linking commits to issues is available on `GitHub +`__. +Be aware that keywords like (close | fix | resolve) will also close the +referenced issue if the pull request is merged. + +Git commits are not required to mention issues. It is sufficient if the PR +links to any relevant issues. + Footer ====== -At the end of the commit message a footer shall be specified +At the end of the commit message a footer may be specified in the following format: .. code-block:: Also-by: Some Bodyelse - Issue-ref: # - - is specified by: - -- see -- close / closes / closed -- fix / fixes / fixed -- resolve / resolves / resolved - -The Reference can contain links to multiple tickets. A detailed -description of linking issues to code is available on `GitHub -`__. -Be aware that keywords like (close | fix | resolve) will also close the referenced issue if the pull request is merged. An additional check is implemented to suppress false positives: if a commit message has revert/merge in the first line, the linting rules @@ -166,5 +162,4 @@ Example Notes about dependencies to other tools or commits in other repositories. - Also-by: Some Bodyelse |br| - Issue-Ref: , , ... + Also-by: Some Bodyelse