Skip to content

Commit 8085050

Browse files
kunaltyagigitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc12974 commit 8085050

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

git-add--interactive.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ sub patch_update_file {
15411541
for (@{$hunk[$ix]{DISPLAY}}) {
15421542
print;
15431543
}
1544-
print colored $prompt_color,
1544+
print colored $prompt_color, "(", ($ix+1), "/$num) ",
15451545
sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other);
15461546

15471547
my $line = prompt_single_character;

t/t3701-add-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ test_expect_success C_LOCALE_OUTPUT 'add first line works' '
314314
git commit -am "clear local changes" &&
315315
git apply patch &&
316316
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/" \
318318
-e "/^[-+@ \\\\]"/p >output &&
319319
test_must_be_empty error &&
320320
git diff --cached >diff &&

0 commit comments

Comments
 (0)