Skip to content

Attribute a backported commit to the pull request it came from - #3054

Merged
soutaro merged 1 commit into
masterfrom
claude/changelog-follow-cherry-picks
Jul 30, 2026
Merged

Attribute a backported commit to the pull request it came from#3054
soutaro merged 1 commit into
masterfrom
claude/changelog-follow-cherry-picks

Conversation

@soutaro

@soutaro soutaro commented Jul 30, 2026

Copy link
Copy Markdown
Member

A backport is a cherry-pick, so its commit is only associated with the pull request that carried the backport — which says nothing about the change, and is the same number for every commit it brought over. All three entries in the 4.0.3 changelog cite #3005.

git cherry-pick -x records the commit a cherry-pick was made from, so gem:changelog now follows it and looks the origin up instead. An origin that leads nowhere falls back to the commit in this history, and cherry-picks made without -x behave as before.

That last part means this only does anything if backports use -x, which docs/release.md now says.


Generated by Claude Code

A backport is a cherry-pick, so the only pull request its commit is
associated with is the one that carried the backport. That pull request
says nothing about the change, and every commit it brought over resolves
to it, so a release branch's changelog credits all of its entries to one
number -- 4.0.3 lists three, all of them #3005.

`git cherry-pick -x` records the commit a cherry-pick was made from, so
follow it: look the recorded origin up instead of the commit, and the
changelog names the pull request the change was written and reviewed in.
A commit backported twice carries one line per hop, so the first one,
where the change started, is the one used.

An origin that leads nowhere -- a commit cherry-picked from a fork, or
one that reached the default branch without a pull request -- falls back
to the commit in this history, which is at least the backport that
brought it here. Cherry-picks made without `-x` record nothing to follow
and behave as before.

The commit messages are read with `%B`, so the output is forced to UTF-8:
unlike the SHAs read until now, a message can hold anything, and
splitting one that is not ASCII fails under `LANG=C`, as in CI.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvSmN7ats6HGEyeT7VEbau
@soutaro soutaro added the skip-changelog Skip PRs in CHANGELOGs label Jul 30, 2026
@soutaro
soutaro enabled auto-merge July 30, 2026 12:48
@soutaro
soutaro added this pull request to the merge queue Jul 30, 2026
Merged via the queue into master with commit 5bbbf86 Jul 30, 2026
25 checks passed
@soutaro
soutaro deleted the claude/changelog-follow-cherry-picks branch July 30, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Skip PRs in CHANGELOGs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants