add -i: show progress counter in the prompt
Report the current hunk count and total number of hunks for the current file in the prompt. Also adjust the expected output in some tests to match. Signed-off-by: Kunal Tyagi <tyagi.kunal@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kunal Tyagi committed
Sep 29, 2019 at 22:22 UTC
8085050ab4e29f442f305e338e6eea750540190e
2 files changed
+2
-2
git-add--interactive.perl
+1
-1
@@ -1541,7 +1541,7 @@ sub patch_update_file {
1541
for (@{$hunk[$ix]{DISPLAY}}) {
1542
print;
1543
}
1544
- print colored $prompt_color,
1544
+ print colored $prompt_color, "(", ($ix+1), "/$num) ",
1545
sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other);
1546
1547
my $line = prompt_single_character;
t/t3701-add-interactive.sh
+1
-1
@@ -314,7 +314,7 @@ test_expect_success C_LOCALE_OUTPUT 'add first line works' '
314
git commit -am "clear local changes" &&
315
git apply patch &&
316
printf "%s\n" s y y | git add -p file 2>error |
317
- sed -n -e "s/^Stage this hunk[^@]*\(@@ .*\)/\1/" \
317
+ sed -n -e "s/^([1-2]\/[1-2]) Stage this hunk[^@]*\(@@ .*\)/\1/" \
318
-e "/^[-+@ \\\\]"/p >output &&
319
test_must_be_empty error &&
320
git diff --cached >diff &&