Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Lint for "origin" lines in commit messages #25291

Open
wants to merge 2 commits into
base: earlgrey_1.0.0
Choose a base branch
from

Conversation

jwnrt
Copy link
Contributor

@jwnrt jwnrt commented Nov 21, 2024

This line indicates whether a commit is original to this branch or was cherry-picked from another.

It should be either:

  • (commit is original to earlgrey_1.0.0)
  • (cherry picked from commit <SHA>)

You can see the lint running here:
https://github.com/jwnrt/opentitan/actions/runs/11952913061/job/33319695210?pr=31

This PR also includes a commit hook for adding the "original" line in util/git/hooks/prepare-commit-msg.

@jwnrt jwnrt force-pushed the commit-origin-line branch 2 times, most recently from 6970d0b to 93db72c Compare November 21, 2024 12:09
Copy link
Contributor

@andreaskurth andreaskurth left a comment

Choose a reason for hiding this comment

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

LGTM technically, though please hold off with merging until all TZs have had a chance to read the announcement email and reply in case of concerns.

Thanks @jwnrt!

@timothytrippel
Copy link
Contributor

timothytrippel commented Nov 21, 2024

I would voice the opinion that having a special commit message for commit messages that originate on the earlgrey_1.0.0 branch is overkill and is going to cause a lot of toil for two reasons:

  1. we don't do this on any other branch (including master), and
  2. there is no hook to automatically apply it when working on one branch, but not apply it when working on another.

Also what value does it provide? I understand the value of the cherry-picked from ... message, and there is automation to apply this.

@andreaskurth andreaskurth self-requested a review November 21, 2024 17:44
Copy link
Contributor

@andreaskurth andreaskurth left a comment

Choose a reason for hiding this comment

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

Let's provide an automation for the (commit is original .. message on the dev side; please hold off until then. I'll follow up offline

@timothytrippel
Copy link
Contributor

Thanks @jwnrt @andreaskurth; I discussed offline with @andreaskurth : I am OK with the commit message if there is a way for a git hook to automatically apply it based on what branch I am working on. Specifically, I am also OK if the target branch needs to be specified on the command line once per branch I create, e.g.,

git checkout -b contribution-to-bringup
git target-branch set earlgrey_1.0.0

This hook adds the `(commit is original to earlgrey_1.0.0)` line to
commit messages if the current branch is descended from `earlgrey_1.0.0`
and does not already have a `(cherry picked from commit ...)` line.

Signed-off-by: James Wainwright <[email protected]>
(commit is original to earlgrey_1.0.0)
This line indicates whether a commit is original to this branch or was
cherry-picked from another.

Signed-off-by: James Wainwright <[email protected]>
(commit is original to earlgrey_1.0.0)
(commit is original to earlgrey_1.0.0)
@jwnrt
Copy link
Contributor Author

jwnrt commented Nov 22, 2024

I've added a commit hook. Instead of requiring an extra config step, it looks to see if the current branch is a descendent of earlgrey_1.0.0.

@jwnrt jwnrt marked this pull request as ready for review November 22, 2024 14:27
@timothytrippel
Copy link
Contributor

awesome, thanks @jwnrt !

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.

3 participants