]> git.ipfire.org Git - thirdparty/git.git/commit
add-patch: render hunks through the pager
authorRubén Justo <rjusto@gmail.com>
Thu, 25 Jul 2024 13:44:52 +0000 (15:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jul 2024 16:03:00 +0000 (09:03 -0700)
commitfc87b2f7c18d0a097c80e4d9ef1f84da687636ab
treef142e5e8846c600feaf3a78555ab153133888ae9
parente8bd8883feb7551f7d1870403d212c77cd56071b
add-patch: render hunks through the pager

Make the print command trigger the pager when invoked using a capital
'P', to make it easier for the user to review long hunks.

Note that if the PAGER ends unexpectedly before we've been able to send
the payload, perhaps because the user is not interested in the whole
thing, we might receive a SIGPIPE, which would abruptly and unexpectedly
terminate the interactive session for the user.

Therefore, we need to ignore a possible SIGPIPE signal.  Add a test for
this, in addition to the test for normal operation.

For the SIGPIPE test, we need to make sure that we completely fill the
operating system's buffer, otherwise we might not trigger the SIGPIPE
signal.  The normal size of this buffer in different OSs varies from a
few KBs to 1MB.  Use a payload large enough to guarantee that we exceed
this limit.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
add-patch.c
t/t3701-add-interactive.sh