]> Kevux Git Server - rit/commit
builtin/history: perform revwalk checks before asking for user input
authorPatrick Steinhardt <ps@pks.im>
Mon, 16 Feb 2026 06:45:44 +0000 (07:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Feb 2026 16:37:51 +0000 (08:37 -0800)
commit76a3f28243ebb0be492f30210f2426a9f511f920
treee37b630617848faa880746f6c511fd7b0f8f2b3a
parent453e7b744aef0d9dab62dac6ab030bb643a2e117
builtin/history: perform revwalk checks before asking for user input

When setting up the revision walk in git-history(1) we also perform some
verifications whether the request actually looks sane. Unfortunately,
these verifications come _after_ we have already asked the user for the
commit message of the commit that is to be rewritten. So in case any of
the verifications fails, the user will have lost their modifications.

Extract the function to set up the revision walk and call it before we
ask for user input to fix this.

Adapt one of the tests that is expected to fail because of this check
to use false(1) as editor. If the editor had been executed by Git, it
would fail with the error message "Aborting commit as launching the
editor failed."

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/history.c
t/t3451-history-reword.sh