* [b4] add notes to patch for commit with git-notes?
@ 2024-09-02 16:51 Quentin Schulz
2024-09-02 17:10 ` Matthieu Baerts
0 siblings, 1 reply; 3+ messages in thread
From: Quentin Schulz @ 2024-09-02 16:51 UTC (permalink / raw)
To: Kernel.org Tools; +Cc: Farouk Bouabid
Hi all,
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#separate-your-changes
says that
> If one patch depends on another patch in order for a change to be
complete, that is OK. Simply note “this patch depends on patch X” in
your patch description.
We forgot to add this note (we weren't aware of the rule at the time)
and made some people unhappy due to some partial merges (one part going
through one tree, its dependency in the same patch series still in review).
I asked some maintainer whether we should have this note in the cover
letter or in the patch and the answer was "ideally both". I know how to
do the former with b4, but not the latter. I would like to avoid having
to use multiple tools to do the same job.
I think it should be possible to use git-notes for the latter?
We did a quick test and it seems it works (with a diff I'm pasting later
in this mail), c.f.
https://lore.kernel.org/linux-rockchip/20240902-dev-mule-i2c-mux-v7-3-bf7b8f5385ed@cherry.de/
For that we had to set notes.rewrite.rebase config to true so that b4
prep --edit-cover wouldn't "erase" the notes (and same with
notes.rewrite.amend just in case one does git commit --amend or reword
with git rebase).
The diff we had for b4 to make this work is the following:
"""
diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index ec230e7..72621b8 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -3424,7 +3424,7 @@ def git_range_to_patches(gitdir: Optional[str],
start: str, end: str,
if commit in ignore_commits:
logger.debug('Ignoring commit %s', commit)
continue
- ecode, out = git_run_command(gitdir, ['show', '--format=email',
'--patch-with-stat', '--encoding=utf-8',
+ ecode, out = git_run_command(gitdir, ['show', '--format=email',
'--patch-with-stat', '--encoding=utf-8', '--notes',
commit], decode=False)
if ecode > 0:
raise RuntimeError(f'Could not get a patch out of {commit}')
"""
Now I'm wondering if we should have this always on or not, also if/how
we should document that one needs to have notes.rewrite.rebase/amend set
for this to work. Should we also add a knob to NOT add the notes (e.g.
someone wants to keep notes for their use but only locally and not send
those).
Let me know if git-notes would be fine and the direction to go for
patches. Thanks!
Cheers,
Quentin
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [b4] add notes to patch for commit with git-notes?
2024-09-02 16:51 [b4] add notes to patch for commit with git-notes? Quentin Schulz
@ 2024-09-02 17:10 ` Matthieu Baerts
2024-09-02 17:19 ` Quentin Schulz
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Baerts @ 2024-09-02 17:10 UTC (permalink / raw)
To: Quentin Schulz, Kernel.org Tools; +Cc: Farouk Bouabid
Hi Quentin,
On 02/09/2024 18:51, Quentin Schulz wrote:
> I think it should be possible to use git-notes for the latter?
Please note :) that these notes can be easily dropped by b4 itself when
editing commits because it uses 'git filter-repo' to do so [1]. In other
words, these notes will be dropped when using 'b4 trailers', or when
using some 'b4 prep' commands when the cover-letter is stored in a
dedicated commit.
> The diff we had for b4 to make this work is the following:
The diff you attached has already proposed before in [2], but not
applied because the notes can be dropped.
> Let me know if git-notes would be fine and the direction to go for
> patches. Thanks!
Unfortunately, I don't think that's the right direction. The alternative
is to add the notes in the commit message, at the end, under '---' [3].
Maybe the direction to take is to document this alternative :)
[1]
https://lore.kernel.org/tools/20220929074717.u2xfvfwq4ki732tw@wittgenstein/T/
[2]
https://lore.kernel.org/tools/20240131223054.371692-1-Frank.Li@nxp.com/T/
[3]
https://lore.kernel.org/tools/jx7vyqdj3qt2zwgsxh6hjac6osr52n2vcmkj2pg3elapcth62m@jtl27si2pa3g/
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [b4] add notes to patch for commit with git-notes?
2024-09-02 17:10 ` Matthieu Baerts
@ 2024-09-02 17:19 ` Quentin Schulz
0 siblings, 0 replies; 3+ messages in thread
From: Quentin Schulz @ 2024-09-02 17:19 UTC (permalink / raw)
To: Matthieu Baerts, Kernel.org Tools; +Cc: Farouk Bouabid
Hi Matthieu,
On 9/2/24 7:10 PM, Matthieu Baerts wrote:
> [Some people who received this message don't often get email from matttbe@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Quentin,
>
> On 02/09/2024 18:51, Quentin Schulz wrote:
>> I think it should be possible to use git-notes for the latter?
>
> Please note :) that these notes can be easily dropped by b4 itself when
> editing commits because it uses 'git filter-repo' to do so [1]. In other
> words, these notes will be dropped when using 'b4 trailers', or when
> using some 'b4 prep' commands when the cover-letter is stored in a
> dedicated commit.
> >> The diff we had for b4 to make this work is the following:
>
> The diff you attached has already proposed before in [2], but not
> applied because the notes can be dropped.
>
>> Let me know if git-notes would be fine and the direction to go for
>> patches. Thanks!
>
> Unfortunately, I don't think that's the right direction. The alternative
> is to add the notes in the commit message, at the end, under '---' [3].
> Maybe the direction to take is to document this alternative :)
>
> [1]
> https://lore.kernel.org/tools/20220929074717.u2xfvfwq4ki732tw@wittgenstein/T/
> [2]
> https://lore.kernel.org/tools/20240131223054.371692-1-Frank.Li@nxp.com/T/
> [3]
> https://lore.kernel.org/tools/jx7vyqdj3qt2zwgsxh6hjac6osr52n2vcmkj2pg3elapcth62m@jtl27si2pa3g/
>
Darn it, I didn't look far enough in lore :( Thanks for doing the
research work I should have done myself!
I didn't know git would keep the --- part in the commit logs, should
have tried the obvious (though I've been bit by #-starting lines
disappearing so I assumed similar behavior :) ).
Thanks for the info and links!
Cheers,
Quentin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-02 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 16:51 [b4] add notes to patch for commit with git-notes? Quentin Schulz
2024-09-02 17:10 ` Matthieu Baerts
2024-09-02 17:19 ` Quentin Schulz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox