public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Christian Brauner <christian@amutable.com>,
	 Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Christian Brauner <brauner@kernel.org>,
	 "Claude Opus 4.6" <noreply@anthropic.com>
Subject: [PATCH b4 2/3] shazam: enable three-way merge for b4 shazam -H
Date: Fri, 06 Mar 2026 12:52:25 +0100	[thread overview]
Message-ID: <20260306-master-v1-2-5a4b9cbe11d7@kernel.org> (raw)
In-Reply-To: <20260306-master-v1-0-5a4b9cbe11d7@kernel.org>

Pass -3 to git-am so three-way merge is attempted automatically when
applying patches in the sparse worktree. Without this, even
auto-resolvable conflicts cause git-am to fail.

Also support a shazam-am-flags config option to allow users to pass
additional flags to git-am.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 src/b4/mbox.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/b4/mbox.py b/src/b4/mbox.py
index 132cbb9..0a86f6f 100644
--- a/src/b4/mbox.py
+++ b/src/b4/mbox.py
@@ -383,12 +383,21 @@ def make_am(msgs: List[EmailMessage], cmdargs: argparse.Namespace, msgid: str) -
 
         base_commit = get_base_commit(topdir, first_body, lser, cmdargs)
         linkurl = linkmask % top_msgid
+
+        am_flags = ['-3']
+        amflags_cfg = str(config.get('shazam-am-flags', ''))
+        if amflags_cfg:
+            sp = shlex.shlex(amflags_cfg, posix=True)
+            sp.whitespace_split = True
+            am_flags.extend(list(sp))
+
         try:
             if cmdargs.mergebase:
                 logger.info(' Base: %s', base_commit)
             else:
                 logger.info(' Base: %s (use --merge-base to override)', base_commit)
-            b4.git_fetch_am_into_repo(topdir, ambytes=ambytes, at_base=base_commit, origin=linkurl)
+            b4.git_fetch_am_into_repo(topdir, ambytes=ambytes, at_base=base_commit,
+                                       origin=linkurl, am_flags=am_flags)
         except b4.AmConflictError as cex:
             b4.git_run_command(topdir, ['worktree', 'remove', '--force', cex.worktree_path])
             logger.critical('Unable to cleanly apply series, see failure log below')

-- 
2.47.3


  parent reply	other threads:[~2026-03-06 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 11:52 [PATCH b4 0/3] shazam: conflict resolution support for b4 shazam -H Christian Brauner
2026-03-06 11:52 ` [PATCH b4 1/3] shazam: refactor git_fetch_am_into_repo for deterministic worktree Christian Brauner
2026-03-06 16:10   ` Konstantin Ryabitsev
2026-03-24 11:33     ` Christian Brauner
2026-03-06 11:52 ` Christian Brauner [this message]
2026-03-06 11:52 ` [PATCH b4 3/3] shazam: enable merge conflict resolution for b4 shazam -H --resolve Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260306-master-v1-2-5a4b9cbe11d7@kernel.org \
    --to=brauner@kernel.org \
    --cc=christian@amutable.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=noreply@anthropic.com \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox