From b351c74a3fc5787e8a41c12342b592d38ef0dede Mon Sep 17 00:00:00 2001 From: Kunal Tyagi Date: Sat, 21 Sep 2019 09:02:52 +0900 Subject: [PATCH] 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 Adjust the expected output in some tests to account for new data on the prompt Signed-off-by: Kunal Tyagi --- git-add--interactive.perl | 2 +- t/t3701-add-interactive.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-add--interactive.perl b/git-add--interactive.perl index c20ae9e2102bff..52659bb74c9b8f 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -1541,7 +1541,7 @@ sub patch_update_file { for (@{$hunk[$ix]{DISPLAY}}) { print; } - print colored $prompt_color, + print colored $prompt_color, "(", ($ix+1), "/$num) ", sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other); my $line = prompt_single_character; diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 69991a3168f354..d50e165ca82f99 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -314,7 +314,7 @@ test_expect_success C_LOCALE_OUTPUT 'add first line works' ' git commit -am "clear local changes" && git apply patch && printf "%s\n" s y y | git add -p file 2>error | - sed -n -e "s/^Stage this hunk[^@]*\(@@ .*\)/\1/" \ + sed -n -e "s/^([1-2]\/[1-2]) Stage this hunk[^@]*\(@@ .*\)/\1/" \ -e "/^[-+@ \\\\]"/p >output && test_must_be_empty error && git diff --cached >diff &&