Hi Rubén On 12/07/2024 02:00, Rubén Justo wrote:
Make the print command to trigger the pager when invoked using a capital
s/to//
'P', to make it easier for the user to review long hunks. Signed-off-by: Rubén Justo <rjusto@xxxxxxxxx>
Thanks for working on this. The code changes all look good, I'm a bit confused by this test though
+test_expect_success TTY 'P does not break if pager ends unexpectly' ' + test_when_finished "rm -f huge_file; git reset" && + printf "%2500000s" Y >huge_file && + git add -N huge_file && + cat >expect <<-EOF && + <GREEN>+<RESET><GREEN>22<RESET> + <GREEN>+<RESET><GREEN>23<RESET> + <GREEN>+<RESET><GREEN>24<RESET> + 30<RESET> + 40<RESET> + 50<RESET> + <BOLD;BLUE>(1/1) Stage this hunk [y,n,q,a,d,s,e,p,?]? <RESET> + EOF + test_write_lines P | + ( + GIT_PAGER="head -1" && + export GIT_PAGER && + test_terminal git add -p >actual + ) && + tail -n 7 <actual | test_decode_color >actual.trimmed && + test_cmp expect actual.trimmed +'
What is huge_file doing and what happens to the single line of pager output? Thanks Phillip
test_expect_success 'split hunk "add -p (edit)"' ' # Split, say Edit and do nothing. Then: #