Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ChangeLog



dana wrote on Wed, 29 Apr 2026 05:12 +00:00:
> On Tue 28 Apr 2026, at 23:15, Bart Schaefer wrote:
>> Yes it does.  It's often the only place that the actual contributor of
>> a patch is recorded when someone else does the git commit.
>
> i feel like people should be setting the author correctly when they do
> that (and i thought they were). but ok
>
> it looks like the last time we back-ported things (5.8.1) i manually
> fixed the change-log entries during cherry-picking. but it was like five
> commits so not too bothersome. doing it for twenty or fifty or w/e isn't
> as appealing tbh...

I think there's a way to configure git to resolve ChangeLog conflicts
automatically, since the syntax and semantics of the ChangeLog file are
so rigid.  Perhaps something to do with the section "Defining a custom
merge driver" in gitattributes(5)?  Not sure, sorry.

HMM, come to think of it...

[[[
#!/bin/sh
# Assuming $1 is a git committish identifying the commit to be cherry-picked
h=$1

# Apply $h and revert the ChangeLog part (which will conflict)
git cherry-pick "$h"
git add ChangeLog  # mark the conflict as resolved
git reset ChangeLog
git checkout ChangeLog

# Apply just the ChangeLog part
git show "$h" -- ChangeLog | patch -p1 --fuzz=3 ChangeLog

# Deduplicate the author-and-date line
if test "$(<ChangeLog grep '^[1-9]' | head -2 | uniq | wc -l)" -eq "1"; then
  # Delete the second author-and-date line.
  printf '%s\n' '2;/^[1-9]/d' 'd' 'w' 'q' | ed -s ChangeLog
fi

git add ChangeLog
git commit --no-edit
]]]

Run `that-nameless-script foo` instead of `git cherry-pick foo`, and it
should just work.  (If your patch(1) doesn't have the --fuzz option,
consider passing `-U0` to `git show` on the same line.)

FWIW, compare CPython's approach: instead of prepending to a file, each
commit creates a new file in NEWS.d/next/${section}/ with one line.
(Example: [1].)  I imagine that at release time, they cat
NEWS.d/next/foo/*.rst into the "foo" section of the release announcement.

HTH,

Daniel

[1] https://github.com/python/cpython/commit/4a5d25c26c01a04c0ddef1a0b00cb55cc835034f#diff-1370e2b9bd32ca60e4ed30bb4259f1eb64822097f4fe83aea241d2f9d5dc89dd




Messages sorted by: Reverse Date, Date, Thread, Author