]> git.ipfire.org Git - thirdparty/git.git/commitdiff
add -i: show progress counter in the prompt
authorKunal Tyagi <tyagi.kunal@live.com>
Mon, 30 Sep 2019 05:22:59 +0000 (22:22 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Oct 2019 22:12:19 +0000 (07:12 +0900)
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>
git-add--interactive.perl
t/t3701-add-interactive.sh

index c20ae9e2102bff6bbf7b66135e2174ec68b33e81..52659bb74c9b8fdd5645403afbe4e715b1e089cb 100755 (executable)
@@ -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;
index 69991a3168f354b8bfefcd396a968e653bb352bd..d50e165ca82f99d7e7bcb5814b73e8cc8f160da9 100755 (executable)
@@ -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 &&