git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] builtin/history: perform revwalk checks before asking for user input

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2026, 20:04 UTC
Message-ID
<xmqqcy29ohi5.fsf@gitster.g>
In-Reply-To
<20260212-b4-pks-history-dry-run-v1-1-1ce03d631c1b@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 8 quoted lines
> 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.
Show 5 quoted lines
> 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(-)
Show 11 quoted lines
> 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.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 34 in “builtin/history: some smaller UI improvements”
  1. 0/4 builtin/history: some smaller UI improvementsPatrick Steinhardt, Feb 12, 2026
  2. 1/4 builtin/history: perform revwalk checks before asking for user inputPatrick Steinhardt, Feb 12, 2026
  3. Junio C HamanoFeb 12, 2026
  4. Patrick SteinhardtFeb 13, 2026
  5. Junio C HamanoFeb 13, 2026
  6. 2/4 builtin/history: check for merges before asking for user inputPatrick Steinhardt, Feb 12, 2026
  7. D. Ben KnobleFeb 12, 2026
  8. Junio C HamanoFeb 12, 2026
  9. Patrick SteinhardtFeb 13, 2026
  10. Patrick SteinhardtFeb 13, 2026
  11. Ben KnobleFeb 13, 2026
  12. 3/4 builtin/history: replace "--ref-action=print" with "--dry-run"Patrick Steinhardt, Feb 12, 2026
  13. Junio C HamanoFeb 12, 2026
  14. Patrick SteinhardtFeb 13, 2026
  15. D. Ben KnobleFeb 12, 2026
  16. Patrick SteinhardtFeb 13, 2026
  17. 4/4 builtin/history: rename "--ref-action=" to "--update-refs="Patrick Steinhardt, Feb 12, 2026
  18. 0/5 builtin/history: some smaller UI improvementsPatrick Steinhardt, Feb 13, 2026
  19. 1/5 builtin/history: perform revwalk checks before asking for user inputPatrick Steinhardt, Feb 13, 2026
  20. Junio C HamanoFeb 13, 2026
  21. 2/5 builtin/history: check for merges before asking for user inputPatrick Steinhardt, Feb 13, 2026
  22. 3/5 builtin/history: replace "--ref-action=print" with "--dry-run"Patrick Steinhardt, Feb 13, 2026
  23. Kristoffer HaugsbakkFeb 13, 2026
  24. Patrick SteinhardtFeb 16, 2026
  25. Kristoffer HaugsbakkFeb 18, 2026
  26. 4/5 builtin/history: rename "--ref-action=" to "--update-refs="Patrick Steinhardt, Feb 13, 2026
  27. 5/5 Documentation/git-history: document default for "--update-refs="Patrick Steinhardt, Feb 13, 2026
  28. Junio C HamanoFeb 13, 2026
  29. 0/5 builtin/history: some smaller UI improvementsPatrick Steinhardt, Feb 16, 2026
  30. 1/5 builtin/history: perform revwalk checks before asking for user inputPatrick Steinhardt, Feb 16, 2026
  31. 2/5 builtin/history: check for merges before asking for user inputPatrick Steinhardt, Feb 16, 2026
  32. 3/5 builtin/history: replace "--ref-action=print" with "--dry-run"Patrick Steinhardt, Feb 16, 2026
  33. 4/5 builtin/history: rename "--ref-action=" to "--update-refs="Patrick Steinhardt, Feb 16, 2026
  34. 5/5 Documentation/git-history: document default for "--update-refs="Patrick Steinhardt, Feb 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.