* b4 feature request: run command before rewriting history
@ 2024-10-10 11:22 Toke Høiland-Jørgensen
2024-10-30 10:16 ` Toke Høiland-Jørgensen
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-10 11:22 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: tools, users
Hi Konstantin
I recently started switching my workflow over to 'b4 prep' for preparing
patches, and am loving the workflow. Thanks a lot for working on this!
However, I ran into one little snag, that I'm hoping could be fixed with
a new b4 feature: I am also a big fan of 'stacked git' (stgit)[0], and
often use that instead of 'rebase -i' when preparing a series for
submission.
So naturally, I want to combine 'b4 prep' with stgit. The problem here
is that stgit maintains its own state for the branches it manages, and
gets awfully confused if the git history is rewritten underneath it.
It's still possible to use it with 'b4 prep', as long as I remember to
do 'stg commit --all' before running any of the b4 commands. And, well,
guess what I already forgot several times? :)
So, my feature request is this: add support to b4 for a hook command
that is executed before any operation that will rewrite history - and
abort the rewriting if the command fails. That way, I can make sure that
I don't forget to clear the stgit state before running b4, saving me
from the pain of dealing with a confused tool.
Do you think this would be feasible to implement?
Many thanks!
-Toke
[0] https://stacked-git.github.io/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
2026-03-06 21:18 ` B4 Bugbot
2026-03-19 21:38 ` B4 Bugbot
2 siblings, 1 reply; 8+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-30 10:16 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: tools, users
Toke Høiland-Jørgensen <toke@redhat.com> writes:
> Hi Konstantin
>
> I recently started switching my workflow over to 'b4 prep' for preparing
> patches, and am loving the workflow. Thanks a lot for working on this!
>
> However, I ran into one little snag, that I'm hoping could be fixed with
> a new b4 feature: I am also a big fan of 'stacked git' (stgit)[0], and
> often use that instead of 'rebase -i' when preparing a series for
> submission.
>
> So naturally, I want to combine 'b4 prep' with stgit. The problem here
> is that stgit maintains its own state for the branches it manages, and
> gets awfully confused if the git history is rewritten underneath it.
> It's still possible to use it with 'b4 prep', as long as I remember to
> do 'stg commit --all' before running any of the b4 commands. And, well,
> guess what I already forgot several times? :)
>
> So, my feature request is this: add support to b4 for a hook command
> that is executed before any operation that will rewrite history - and
> abort the rewriting if the command fails. That way, I can make sure that
> I don't forget to clear the stgit state before running b4, saving me
> from the pain of dealing with a confused tool.
>
> Do you think this would be feasible to implement?
Hi Konstantin
Friendly ping on the above? :)
-Toke
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
0 siblings, 1 reply; 8+ messages in thread
From: Konstantin Ryabitsev @ 2024-10-30 17:36 UTC (permalink / raw)
To: Toke Høiland-Jørgensen; +Cc: tools, users
On Wed, Oct 30, 2024 at 11:16:15AM +0100, Toke Høiland-Jørgensen wrote:
> > Do you think this would be feasible to implement?
>
> Hi Konstantin
>
> Friendly ping on the above? :)
Yeah, I hope to be able to look into this in the near future. Unfortunately,
I've been dealing with less-than-pleasant tasks such as ddos attacks and
trolls over the past couple of weeks, but at least it's finally on the wane as
people move on.
-K
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
0 siblings, 1 reply; 8+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-31 10:29 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: tools, users
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
> On Wed, Oct 30, 2024 at 11:16:15AM +0100, Toke Høiland-Jørgensen wrote:
>> > Do you think this would be feasible to implement?
>>
>> Hi Konstantin
>>
>> Friendly ping on the above? :)
>
> Yeah, I hope to be able to look into this in the near future. Unfortunately,
> I've been dealing with less-than-pleasant tasks such as ddos attacks and
> trolls over the past couple of weeks, but at least it's finally on the wane as
> people move on.
Right, no worries, just wanted to make sure this didn't get lost
entirely. Thanks for looking at it! :)
-Toke
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
0 siblings, 1 reply; 8+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-02-12 15:36 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: tools, users
Toke Høiland-Jørgensen <toke@redhat.com> writes:
> Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
>
>> On Wed, Oct 30, 2024 at 11:16:15AM +0100, Toke Høiland-Jørgensen wrote:
>>> > Do you think this would be feasible to implement?
>>>
>>> Hi Konstantin
>>>
>>> Friendly ping on the above? :)
>>
>> Yeah, I hope to be able to look into this in the near future. Unfortunately,
>> I've been dealing with less-than-pleasant tasks such as ddos attacks and
>> trolls over the past couple of weeks, but at least it's finally on the wane as
>> people move on.
>
> Right, no worries, just wanted to make sure this didn't get lost
> entirely. Thanks for looking at it! :)
Hi Konstantin
Another friendly ping on this? :)
-Toke
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
2025-02-12 15:36 ` Toke Høiland-Jørgensen
@ 2026-03-06 21:14 ` Konstantin Ryabitsev
0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Ryabitsev @ 2026-03-06 21:14 UTC (permalink / raw)
To: Toke Høiland-Jørgensen; +Cc: tools, users
On Wed, Feb 12, 2025 at 04:36:46PM +0100, Toke Høiland-Jørgensen wrote:
> Toke Høiland-Jørgensen <toke@redhat.com> writes:
>
> > Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
> >
> >> On Wed, Oct 30, 2024 at 11:16:15AM +0100, Toke Høiland-Jørgensen wrote:
> >>> > Do you think this would be feasible to implement?
> >>>
> >>> Hi Konstantin
> >>>
> >>> Friendly ping on the above? :)
> >>
> >> Yeah, I hope to be able to look into this in the near future. Unfortunately,
> >> I've been dealing with less-than-pleasant tasks such as ddos attacks and
> >> trolls over the past couple of weeks, but at least it's finally on the wane as
> >> people move on.
> >
> > Right, no worries, just wanted to make sure this didn't get lost
> > entirely. Thanks for looking at it! :)
>
> Hi Konstantin
>
> Another friendly ping on this? :)
Only a year later, finally adding this to the tracker. I'm sure you've given
up, but this has been sitting in my inbox for a while, shaming me.
bugspray tag b4/prep
--
KR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
@ 2026-03-06 21:18 ` B4 Bugbot
2026-03-19 21:38 ` B4 Bugbot
2 siblings, 0 replies; 8+ messages in thread
From: B4 Bugbot @ 2026-03-06 21:18 UTC (permalink / raw)
To: toke, tools, users, konstantin
Hello:
This conversation is now tracked by b4 bug tracker.
There is no need to do anything else, just keep talking.
--
Deet-doot-dot, I am a bot.
b4 bug tracker (bugspray 0.1-dev)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: b4 feature request: run command before rewriting history
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
2026-03-06 21:18 ` B4 Bugbot
@ 2026-03-19 21:38 ` B4 Bugbot
2 siblings, 0 replies; 8+ messages in thread
From: B4 Bugbot @ 2026-03-19 21:38 UTC (permalink / raw)
To: tools, konstantin, toke, users
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)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-03-19 21:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox