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

Re: [PATCH 2/2] add-patch: do not print hunks repeatedly

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2024, 21:34 UTC
Message-ID
<xmqqjzlqgfm1.fsf@gitster.g>
In-Reply-To
<6bc655ea-783e-477e-84ec-04503fa20799@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 23 quoted lines
> ... or an invalid option, i.e: "U"
> ...
>     (1/4) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? U
> ...
>     ? - print help
>     @@ -1394,7 +1394,7 @@ N_("j - leave this hunk undecided, see next undecided hunk\n"
>      static int patch_update_file(struct add_p_state *s,
>      			     struct file_diff *file_diff)
>      {
>     -	size_t hunk_index = 0;
>     +	size_t hunk_index = 0, prev_hunk_index = -1;
>      	ssize_t i, undecided_previous, undecided_next;
>      	struct hunk *hunk;
>      	char ch;
>     (1/4) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]?
>
> Printing the chunk again followed by the question can be confusing as
> the user has to pay special attention to notice that the same chunk is
> being reconsidered.
>
> It can also be problematic if the chunk is longer than one screen height
> because the result of the previous iteration is lost off the screen (the
> help guide in the previous example).

Indeed. The more important part of the message from the command in these cases tells that the previous input was invalid and why.

Stopping after that without showing the hunk again does make sense.
Previous: Rubén JustoNext: Rubén Justo
Message 7 of 42 in “improve interactive-patch”
  1. 0/2 improve interactive-patchRubén Justo, Mar 25, 2024
  2. 1/2 add-patch: introduce 'p' in interactive-patchRubén Justo, Mar 25, 2024
  3. Junio C HamanoMar 25, 2024
  4. Rubén JustoMar 25, 2024
  5. Junio C HamanoMar 25, 2024
  6. 2/2 add-patch: do not print hunks repeatedlyRubén Justo, Mar 25, 2024
  7. Junio C HamanoMar 25, 2024
  8. 0/2 improve interactive-patchRubén Justo, Mar 26, 2024
  9. 1/2 add-patch: introduce 'p' in interactive-patchRubén Justo, Mar 26, 2024
  10. Phillip WoodMar 26, 2024
  11. Rubén JustoMar 26, 2024
  12. Phillip WoodMar 27, 2024
  13. 2/2 add-patch: do not print hunks repeatedlyRubén Justo, Mar 26, 2024
  14. Phillip WoodMar 26, 2024
  15. Rubén JustoMar 26, 2024
  16. Phillip WoodMar 27, 2024
  17. Rubén JustoMar 28, 2024
  18. Phillip WoodMar 26, 2024
  19. Junio C HamanoMar 26, 2024
  20. Rubén JustoMar 26, 2024
  21. Junio C HamanoMar 26, 2024
  22. Rubén JustoMar 26, 2024
  23. Rubén JustoMar 29, 2024
  24. Dragan SimicMar 29, 2024
  25. Rubén JustoMar 30, 2024
  26. Junio C HamanoMar 30, 2024
  27. Phillip WoodMar 27, 2024
  28. Junio C HamanoMar 27, 2024
  29. Phillip WoodMar 27, 2024
  30. Rubén JustoMar 28, 2024
  31. Rubén JustoMar 26, 2024
  32. 0/2 improve interactive-patchRubén Justo, Mar 28, 2024
  33. 1/2 add-patch: introduce 'p' in interactive-patchRubén Justo, Mar 28, 2024
  34. Junio C HamanoMar 28, 2024
  35. 2/2 add-patch: do not print hunks repeatedlyRubén Justo, Mar 28, 2024
  36. Junio C HamanoMar 28, 2024
  37. Rubén JustoMar 29, 2024
  38. 0/2 improve interactive-patchRubén Justo, Mar 29, 2024
  39. 1/2 add-patch: introduce 'p' in interactive-patchRubén Justo, Mar 29, 2024
  40. 2/2 add-patch: do not print hunks repeatedlyRubén Justo, Mar 29, 2024
  41. phillip.wood123@gmail.comMar 29, 2024
  42. Rubén JustoMar 29, 2024

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.