Skip to content

Commit 7309be1

Browse files
rjustogitster
authored andcommitted
add-patch: test for 'p' command
Add a test for the 'p' command, which was introduced in 66c14ab (add-patch: introduce 'p' in interactive-patch, 2024-03-29). Signed-off-by: Rubén Justo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7dae3b commit 7309be1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t3701-add-interactive.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,22 @@ test_expect_success 'navigate to hunk via regex / pattern' '
575575
test_cmp expect actual.trimmed
576576
'
577577

578+
test_expect_success 'print again the hunk' '
579+
test_when_finished "git reset" &&
580+
tr _ " " >expect <<-EOF &&
581+
+15
582+
20
583+
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? @@ -1,2 +1,3 @@
584+
10
585+
+15
586+
20
587+
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]?_
588+
EOF
589+
test_write_lines s y g 1 p | git add -p >actual &&
590+
tail -n 7 <actual >actual.trimmed &&
591+
test_cmp expect actual.trimmed
592+
'
593+
578594
test_expect_success 'split hunk "add -p (edit)"' '
579595
# Split, say Edit and do nothing. Then:
580596
#

0 commit comments

Comments
 (0)