From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/4] builtin/history: perform revwalk checks before asking for user input
Date: Thu, 12 Feb 2026 12:04:50 -0800 [thread overview]
Message-ID: <xmqqcy29ohi5.fsf@gitster.g> (raw)
In-Reply-To: <20260212-b4-pks-history-dry-run-v1-1-1ce03d631c1b@pks.im> (Patrick Steinhardt's message of "Thu, 12 Feb 2026 13:44:34 +0100")
Patrick Steinhardt <ps@pks.im> writes:
> 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.
That's a huge usability improvement. Nice.
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> builtin/history.c | 69 +++++++++++++++++++++++++++++------------------
> t/t3451-history-reword.sh | 2 +-
> 2 files changed, 44 insertions(+), 27 deletions(-)
> diff --git a/t/t3451-history-reword.sh b/t/t3451-history-reword.sh
> index 3594421b68..6775ed62f9 100755
> --- a/t/t3451-history-reword.sh
> +++ b/t/t3451-history-reword.sh
> @@ -263,7 +263,7 @@ test_expect_success '--ref-action=head updates only HEAD' '
>
> # When told to update HEAD, only, the command will refuse to
> # rewrite commits that are not an ancestor of HEAD.
> - test_must_fail git history reword --ref-action=head theirs 2>err &&
> + test_must_fail git -c core.editor=false history reword --ref-action=head theirs 2>err &&
> test_grep "rewritten commit must be an ancestor of HEAD" err &&
This ensures that the editor is never consulted? How? Running the
"false" editor would give us a different error, like "your editor
exited with non-zero status, telling us to abort" or something?
Thanks.
next prev parent reply other threads:[~2026-02-12 20:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 12:44 [PATCH 0/4] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-12 12:44 ` [PATCH 1/4] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-12 20:04 ` Junio C Hamano [this message]
2026-02-13 5:51 ` Patrick Steinhardt
2026-02-13 17:02 ` Junio C Hamano
2026-02-12 12:44 ` [PATCH 2/4] builtin/history: check for merges " Patrick Steinhardt
2026-02-12 22:20 ` D. Ben Knoble
2026-02-12 22:26 ` Junio C Hamano
2026-02-13 5:51 ` Patrick Steinhardt
2026-02-13 5:51 ` Patrick Steinhardt
2026-02-13 13:42 ` Ben Knoble
2026-02-12 12:44 ` [PATCH 3/4] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-12 20:19 ` Junio C Hamano
2026-02-13 5:50 ` Patrick Steinhardt
2026-02-12 22:20 ` D. Ben Knoble
2026-02-13 5:50 ` Patrick Steinhardt
2026-02-12 12:44 ` [PATCH 4/4] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-13 9:12 ` [PATCH v2 0/5] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-13 9:12 ` [PATCH v2 1/5] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-13 17:20 ` Junio C Hamano
2026-02-13 9:12 ` [PATCH v2 2/5] builtin/history: check for merges " Patrick Steinhardt
2026-02-13 9:12 ` [PATCH v2 3/5] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-13 17:30 ` Kristoffer Haugsbakk
2026-02-16 6:39 ` Patrick Steinhardt
2026-02-18 16:09 ` Kristoffer Haugsbakk
2026-02-13 9:12 ` [PATCH v2 4/5] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-13 9:12 ` [PATCH v2 5/5] Documentation/git-history: document default for "--update-refs=" Patrick Steinhardt
2026-02-13 17:21 ` Junio C Hamano
2026-02-16 6:45 ` [PATCH v3 0/5] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-16 6:45 ` [PATCH v3 1/5] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-16 6:45 ` [PATCH v3 2/5] builtin/history: check for merges " Patrick Steinhardt
2026-02-16 6:45 ` [PATCH v3 3/5] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-16 6:45 ` [PATCH v3 4/5] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-16 6:45 ` [PATCH v3 5/5] Documentation/git-history: document default for "--update-refs=" Patrick Steinhardt
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=xmqqcy29ohi5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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