<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/add-patch.c, branch origin/maint</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=origin%2Fmaint</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=origin%2Fmaint'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2025-10-26T23:34:39Z</updated>
<entry>
<title>add-patch: quit on EOF</title>
<updated>2025-10-26T23:34:39Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-25T05:48:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e56f6dcd7b4c90192018e848d0810f091d092913'/>
<id>urn:sha1:e56f6dcd7b4c90192018e848d0810f091d092913</id>
<content type='text'>
If we reach the end of the input, e.g. because the user pressed ctrl-D
on Linux, there is no point in showing any more prompts, as we won't get
any reply.  Do the same as option 'q' would: Quit.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add-patch: quit without skipping undecided hunks</title>
<updated>2025-10-25T16:45:07Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-25T05:46:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=13768117f5e174a7a0403607532e33a7dc40b969'/>
<id>urn:sha1:13768117f5e174a7a0403607532e33a7dc40b969</id>
<content type='text'>
Option q implies d, i.e., it marks any undecided hunks towards the
bottom of the hunk array as skipped.  This is unnecessary; later code
treats undecided and skipped hunks the same: The only functions that
use UNDECIDED_HUNK and SKIP_HUNK are patch_update_file() itself (but
not after its big for loop) and its helpers get_first_undecided() and
display_hunks().

Streamline the handling of option q by quitting immediately.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/add-patch-document-p-for-pager'</title>
<updated>2025-10-24T20:48:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-10-24T20:48:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=7d763b98ef35d78a47c0606c6824e677b67bcb1c'/>
<id>urn:sha1:7d763b98ef35d78a47c0606c6824e677b67bcb1c</id>
<content type='text'>
Show 'P'ipe command in "git add -p".

* rs/add-patch-document-p-for-pager:
  add-patch: fully document option P
</content>
</entry>
<entry>
<title>add-patch: fully document option P</title>
<updated>2025-10-21T21:35:44Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-21T18:02:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=301e20da208d23e9ea03d58e1488973c6f1f939a'/>
<id>urn:sha1:301e20da208d23e9ea03d58e1488973c6f1f939a</id>
<content type='text'>
Show option P in the prompt and explain it properly on a dedicated line
in online help and documentation.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/add-patch-options-fix'</title>
<updated>2025-10-17T21:02:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-10-17T21:02:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=cd6c082b4407b1e217ee36f50498615602e57bf3'/>
<id>urn:sha1:cd6c082b4407b1e217ee36f50498615602e57bf3</id>
<content type='text'>
The code in "git add -p" and friends to iterate over hunks was
riddled with bugs, which has been corrected.

* rs/add-patch-options-fix:
  add-patch: reset "permitted" at loop start
  add-patch: let options a and d roll over like y and n
  add-patch: let options k and K roll over like j and J
  add-patch: let options y, n, j, and e roll over to next undecided
  add-patch: document that option J rolls over
  add-patch: improve help for options j, J, k, and K
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-hunk-splitting-fix'</title>
<updated>2025-10-14T19:56:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-10-14T19:56:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=243a61d2cffe790ba811f5a7922a7e6a365b2922'/>
<id>urn:sha1:243a61d2cffe790ba811f5a7922a7e6a365b2922</id>
<content type='text'>
Marking a hunk 'selected' in "git add -p" and then splitting made
all the split pieces 'selected'; this has been changed to make them
all 'undecided', which gives better end-user experience.

* pw/add-p-hunk-splitting-fix:
  add-patch: update hunk splitability after editing
  add -p: mark split hunks as undecided
</content>
</entry>
<entry>
<title>add-patch: reset "permitted" at loop start</title>
<updated>2025-10-06T17:51:43Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-06T17:24:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=208e23ea47ad71c20246ff234efa3abc8080513f'/>
<id>urn:sha1:208e23ea47ad71c20246ff234efa3abc8080513f</id>
<content type='text'>
Don't accumulate allowed options from any visited hunks, start fresh at
the top of the loop instead and only record the allowed options for the
current hunk.

Reported-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add-patch: let options a and d roll over like y and n</title>
<updated>2025-10-06T17:51:43Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-06T17:23:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e8c744dd9a0270d616ab10aaddfa07cfc071e382'/>
<id>urn:sha1:e8c744dd9a0270d616ab10aaddfa07cfc071e382</id>
<content type='text'>
Options a and d stage and unstage all undecided hunks towards the bottom
of the array of hunks, respectively, and then roll over to the very
first hunk.  The first part is similar to y and n if the current hunk is
the last one in the array, but they roll over to the next undecided
hunk if there is any.  That's more useful; do it for a and d as well.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add-patch: let options k and K roll over like j and J</title>
<updated>2025-10-06T17:51:42Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-06T17:22:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=1967b60681256ed452ed70dedf381b5380697901'/>
<id>urn:sha1:1967b60681256ed452ed70dedf381b5380697901</id>
<content type='text'>
Options j and J roll over at the bottom and go to the first undecided
hunk and hunk 1, respectively.  Let options k and K do the same when
they reach the top of the hunk array, so let them go to the last
undecided hunk and the last hunk, respectively, for consistency.  Also
use the same direction-neutral error messages.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add-patch: let options y, n, j, and e roll over to next undecided</title>
<updated>2025-10-06T17:51:42Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-06T17:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=171c1688ccbe5e6d709444a65a5ca2e0a9175b16'/>
<id>urn:sha1:171c1688ccbe5e6d709444a65a5ca2e0a9175b16</id>
<content type='text'>
The options y, n, and e mark the current hunk as decided.  If there's
another undecided hunk towards the bottom of the hunk array they go
there.  If there isn't, but there is another undecided hunk towards the
top then they go to the very first hunk, no matter if it has already
been decided on.

The option j does basically the same move.  Technically it is not
allowed if there's no undecided hunk towards the bottom, but the
variable "permitted" is never reset, so this permission is retained
from the very first hunk.  That may a bug, but this behavior is at
least consistent with y, n, and e and arguably more useful than
refusing to move.

Improve the roll-over behavior of these four options by moving to the
first undecided hunk instead of hunk 1, consistent with what they do
when not rolling over.

Also adjust the error message for j, as it will only be shown if
there's no other undecided hunk in either direction.

Reported-by: Windl, Ulrich &lt;u.windl@ukr.de&gt;
Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
