diff mbox series

b4: Include git notes when generating patches

Message ID 20250130201331.73584-1-yazen.ghannam@amd.com (mailing list archive)
State New
Headers show
Series b4: Include git notes when generating patches | expand

Commit Message

Yazen Ghannam Jan. 30, 2025, 8:13 p.m. UTC
By default, 'git show' will include git notes in its output. However,
this is not the case if '--format', or related flags, are given.

Include the '--notes' flag to include git notes in the generated patch.

This should have no effect on non-users of git notes.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
 src/b4/__init__.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Konstantin Ryabitsev Jan. 30, 2025, 8:30 p.m. UTC | #1
On Thu, Jan 30, 2025 at 08:13:31PM +0000, Yazen Ghannam wrote:
> By default, 'git show' will include git notes in its output. However,
> this is not the case if '--format', or related flags, are given.
> 
> Include the '--notes' flag to include git notes in the generated patch.

I'd love to do that, but git-filter-repo currently doesn't do the right thing
with notes, so anyone who starts to rely on notes will find that they are
easily lost with most common b4 operations. There's a long-standing RFE to
support notes with git-filter-repo:

https://github.com/newren/git-filter-repo/issues/22

Until that happens, I really don't want to pretend that we support notes,
because this will result in bad experiences for most who try it.

-K
Yazen Ghannam Jan. 30, 2025, 9:04 p.m. UTC | #2
On Thu, Jan 30, 2025 at 03:30:59PM -0500, Konstantin Ryabitsev wrote:
> On Thu, Jan 30, 2025 at 08:13:31PM +0000, Yazen Ghannam wrote:
> > By default, 'git show' will include git notes in its output. However,
> > this is not the case if '--format', or related flags, are given.
> > 
> > Include the '--notes' flag to include git notes in the generated patch.
> 
> I'd love to do that, but git-filter-repo currently doesn't do the right thing
> with notes, so anyone who starts to rely on notes will find that they are
> easily lost with most common b4 operations. There's a long-standing RFE to
> support notes with git-filter-repo:
> 
> https://github.com/newren/git-filter-repo/issues/22
> 
> Until that happens, I really don't want to pretend that we support notes,
> because this will result in bad experiences for most who try it.
> 

Right, I've encountered issues myself. I've found that the 'tip-commit'
cover letter strategy works, since git-filter-repo will only operate on
the final commit.

Could we document some tips for this topic? Or just leave it for now?

Thanks,
Yazen
Konstantin Ryabitsev Jan. 30, 2025, 9:29 p.m. UTC | #3
On Thu, Jan 30, 2025 at 04:04:53PM -0500, Yazen Ghannam wrote:
> > I'd love to do that, but git-filter-repo currently doesn't do the right thing
> > with notes, so anyone who starts to rely on notes will find that they are
> > easily lost with most common b4 operations. There's a long-standing RFE to
> > support notes with git-filter-repo:
> > 
> > https://github.com/newren/git-filter-repo/issues/22
> > 
> > Until that happens, I really don't want to pretend that we support notes,
> > because this will result in bad experiences for most who try it.
> > 
> 
> Right, I've encountered issues myself. I've found that the 'tip-commit'
> cover letter strategy works, since git-filter-repo will only operate on
> the final commit.

Unfortunately, tip-commit is not going to fix all instances where this is
likely to break. E.g. running 'b4 trailers -u' will also rebase your series
and lose your notes.

> Could we document some tips for this topic? Or just leave it for now?

I'd just leave it for now. Hopefully, we'll eventually get to the point where
notes are supported without any workarounds (though I've been waiting for a
few years now).

-K
diff mbox series

Patch

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 4d234e01d993..23ee39bdabf9 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -3487,6 +3487,7 @@  def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
             gitdir,
             [
                 'show',
+                '--notes',
                 '--format=email',
                 '--binary',
                 '--patch-with-stat',