Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 "Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH b4 4/6] fake-am: use the scratch-worktree overrides in the staging worktree
Date: Wed, 29 Jul 2026 12:44:31 +0200	[thread overview]
Message-ID: <20260729-work-b4-scratch-worktrees-v1-4-e96995158d4a@kernel.org> (raw)
In-Reply-To: <20260729-work-b4-scratch-worktrees-v1-0-e96995158d4a@kernel.org>

make_fake_am_range() has a throwaway worktree of its own. It stages the
blobs the series expects to find, commits that tree, resets onto it and
ams the patches on top to get a commit range b4 can diff against. b4
diff goes through it, and so do the review TUI's range-diff and its
three-way merge prep.

The reset recurses like any other. A series that touches a submodule
puts a gitlink into the synthesized tree, and the reset then dies in
the same fresh worktree with no submodule clones. The am is worse.
Those commits exist to compute a diff range and nothing ever references
them, but git still reaches for the user's signing key, and with a card
that is not plugged in the whole range fails.

Both get SCRATCH_GIT_OPTS.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
 src/b4/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 1a883b4..d418cee 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -1449,13 +1449,15 @@ class LoreSeries:
                 return None, None
             start_commit = out.strip()
             logger.debug('start_commit=%s', start_commit)
-            git_run_command(dfn, ['reset', '--hard', start_commit])
+            git_run_command(dfn, [*SCRATCH_GIT_OPTS, 'reset', '--hard', start_commit])
 
             ifh = io.BytesIO()
             save_git_am_mbox(msgs, ifh)
             ambytes = ifh.getvalue()
 
-            ecode, out = git_run_command(dfn, ['am'], stdin=ambytes, logstderr=True)
+            ecode, out = git_run_command(
+                dfn, [*SCRATCH_GIT_OPTS, 'am'], stdin=ambytes, logstderr=True
+            )
             if ecode > 0:
                 logger.critical('ERROR: Could not fake-am version v%s', self.revision)
                 return None, None

-- 
2.53.0


  parent reply	other threads:[~2026-07-29 10:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 10:44 [PATCH b4 0/6] Keep the user's git config out of b4's scratch worktrees Christian Brauner
2026-07-29 10:44 ` [PATCH b4 1/6] git_run_command: look past -c overrides for the subcommand Christian Brauner
2026-07-29 10:44 ` [PATCH b4 2/6] shazam: ignore the user's submodule.recurse in the scratch worktree Christian Brauner
2026-07-29 10:44 ` [PATCH b4 3/6] review-tui: use the shared scratch-worktree overrides for test applies Christian Brauner
2026-07-29 10:44 ` Christian Brauner [this message]
2026-07-29 10:44 ` [PATCH b4 5/6] send: use the scratch-worktree overrides when tagging a sent series Christian Brauner
2026-07-29 10:44 ` [PATCH b4 6/6] tests: exercise the scratch worktrees under submodule.recurse Christian Brauner
2026-07-31  5:08 ` [PATCH b4 0/6] Keep the user's git config out of b4's scratch worktrees Konstantin Ryabitsev

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=20260729-work-b4-scratch-worktrees-v1-4-e96995158d4a@kernel.org \
    --to=brauner@kernel.org \
    --cc=konstantin@linuxfoundation.org \
    --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