Skip to content

Auto-append PR/Issue ID to all commits #582

@SyntevoAlex

Description

@SyntevoAlex

Summary of the problem:

  • after moving to GitHub, many commits lack corresponding PR or Issue link.
  • While GitHub allows to see which PR merged a specific commit, it's a bad idea to rely on that because SWT could move from GitHub some day.
  • The suggestion is to introduce some scripts to auto-append the link when merging a PR.

Now a longer discussion:

  • Before moving to GitHub, commits were expected to be named like Bug 123456 - Some Description. That is, there was always a bug number in the beginning.
  • This makes it trivial to map a commit to Bugzilla entry and doesn't require any additional tools. Can be done easily in most environments.
  • GitHub shows corresponding PR in commit description, for example see 8457de2, the header on top of page says
    master #428
    v4960r3 ... I20221011-0640
    
    where #428 is the corresponding PR.
    • However, not everyone knows that. I consider myself skilled, but I didn't know about this feature. What about newcomers? I would expect that many of them will not know this.
    • However, we can't be certain that SWT stays on GitHub forever. If SWT decides to move to any other platform, this mapping will be likely be lost, because it doesn't exist anywhere in the repo itself.

One solution will be to restore discipline and require good commit messages from committers

  • However, people are people, and that will require someone to spend time watching
    • This can be solved with GitHub-side check that doesn't allow to merge PR unless commits ave proper messages
  • However, for PR-only commits (that is, without any Issue and just PR), the PR number can't be known in advance, so committer will have to create commit, create PR, then immediately adjust commit message to mention the PR identifier obtained.

The other solution would be to have GitHub-side scripts to auto-append required information in commit messages

  • It will at least append links to PR/Issue involved
  • It could also append various useful stuff like participating reviewers
  • It could also maybe append the entire discussion from PR/Issue into the commit message? So that possible transition from GitHub will become really easy later

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions