From: B4 Bugbot <bugbot+b4@kernel.org>
To: tools@linux.kernel.org, konstantin@linuxfoundation.org,
toke@redhat.com, users@linux.kernel.org
Subject: Re: b4 feature request: run command before rewriting history
Date: Thu, 19 Mar 2026 21:38:51 +0000 (UTC) [thread overview]
Message-ID: <20260319-b73df66cc6-5ca5125a64ff@git.kernel.org> (raw)
In-Reply-To: <87ttdkrylx.fsf@toke.dk>
Konstantin Ryabitsev writes in commit bc6c4d853c7eace3b7f325cbd17dfe2d67760fb7:
prep: add pre/post history-rewrite hooks
Add two new configuration keys, prep-pre-rewrite-hook and
prep-post-rewrite-hook, that let users run a command before and after
any b4 operation that rewrites history on a prep branch.
The pre-hook runs before the rewrite and aborts the operation if it
exits non-zero. The post-hook runs after a successful rewrite; a
non-zero exit is logged as a warning but does not undo anything.
The primary use case is Stacked Git: users can set
prep-pre-rewrite-hook to "stg commit --all" so that StGit's internal
state is cleared before b4 modifies the branch, and
prep-post-rewrite-hook to "stg repair" to re-sync afterwards.
Hooks are called around git-filter-repo runs in run_frf(), which
covers all history rewrites on existing prep branches: cover letter
updates, trailer updates, and reroll cover rewrites.
Key changes:
- New run_rewrite_hook() helper in ez.py
- Instrumented run_frf() with pre/post hooks around frf.run()
- Added 6 unit tests for the hook mechanism
- Documented both config keys in docs/config.rst
Suggested-by: Toke Høiland-Jørgensen <toke@toke.dk>
Closes: https://msgid.link/87ttdkrylx.fsf@toke.dk # 73df66c
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Assisted-by: claude-opus-4-6
--
Deet-doot-dot, I am a bot.
b4 bug tracker (bugspray 0.1-dev)
prev parent reply other threads:[~2026-03-19 21:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 11:22 b4 feature request: run command before rewriting history Toke Høiland-Jørgensen
2024-10-30 10:16 ` Toke Høiland-Jørgensen
2024-10-30 17:36 ` Konstantin Ryabitsev
2024-10-31 10:29 ` Toke Høiland-Jørgensen
2025-02-12 15:36 ` Toke Høiland-Jørgensen
2026-03-06 21:14 ` Konstantin Ryabitsev
2026-03-06 21:18 ` B4 Bugbot
2026-03-19 21:38 ` B4 Bugbot [this message]
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=20260319-b73df66cc6-5ca5125a64ff@git.kernel.org \
--to=bugbot+b4@kernel.org \
--cc=konstantin@linuxfoundation.org \
--cc=toke@redhat.com \
--cc=tools@linux.kernel.org \
--cc=users@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.