On 2024-03-28 17:50, Junio C Hamano wrote:
Eugenio Bargiacchi <svalorzen@xxxxxxxxx> writes:
I'm looking for a way to print some sort of separator between hunks
when running `git add -p`, as I have a bit of trouble detecting when
the previous hunk begins and the current one starts. Being able to
print an empty line or a couple lines filled with "=======" would
really help me out.
Hmph, my hope when I designed that particular UI was that the
command prompt for the previous interaction followed by the hunk
header of the current hunk would give us clear enough separation.
For example, after answering "n" to the prompt for the previous
hunk, we'd see
...
+ (merge bff85a338c bl/doc-key-val-sep-fix later to maint).
+
* Other code cleanup, docfix, build fix, etc.
(merge f0e578c69c rs/use-xstrncmpz later to maint).
(merge 83e6eb7d7a ba/credential-test-clean-fix later to maint).
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
@@ -233,3 +245,6 @@ Fixes since v2.44
(merge 781fb7b4c2 as/option-names-in-messages later to maint).
(merge 51d41dc243 jk/doc-remote-helpers-markup-fix later to
maint).
(merge e1aaf309db pb/ci-win-artifact-names-fix later to maint).
+ (merge ad538c61da jc/index-pack-fsck-levels later to maint).
+ (merge 67471bc704 ja/doc-formatting-fix later to maint).
...
(2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]?
The '@' (the first character of the hunk header line for the current
hunk) and "(1/2" are surrounded by lines that begin with a space,
and the hope was that it was sufficient "separator" already.
These days (long after I stopped mucking with the interactive add
code actively), the prompt line is painted in prompt_color (you can
tweak it with the color.interactive.prompt configuration variable,
it defaults to BOLD BLUE) while the first part of the hunk header
line is painted in the fraginfo color (default CYAN), which should
give you even more visual distinction.
Perhaps
[color "interactive"]
prompt = bold red reverse
would be sufficient? I dunno.
Here's a possible solution, or better said a new configuration option,
which I've been thinking about for a while... When running "add -p",
displayed chunks can sometimes become confusing or a bit hard on the
eyes, but simply clearing the screen _before_ displaying any new step
(i.e. a new chunk, interactive help, etc.) could make it much easier
on the eyes. It would be a new option, of course.
Thoughts?