git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 1/1] add -i: Show progress counter in the prompt

From
KGKunal Tyagi via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 30, 2019, 05:22 UTC
Message-ID
<b351c74a3fc5787e8a41c12342b592d38ef0dede.1569820977.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.349.v3.git.gitgitgadget@gmail.com>
From: Kunal Tyagi <tyagi.kunal@live.com>

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 <tyagi.kunal@live.com>
---
 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 c20ae9e210..52659bb74c 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 69991a3168..d50e165ca8 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 &&
-- 
gitgitgadget
Previous: Kunal Tyagi via GitGitGadgetNext: Junio C Hamano
Message 10 of 11 in “git-add--interactive.perl: Add progress counter in the prompt”
  1. 0/1 git-add--interactive.perl: Add progress counter in the promptKunal Tyagi via GitGitGadget, Sep 23, 2019
  2. 1/1 git-add--interactive.perl: Add progress counter in the promptKunal Tyagi via GitGitGadget, Sep 23, 2019
  3. Johannes SchindelinSep 25, 2019
  4. Johannes SchindelinSep 25, 2019
  5. 0/1 git-add--interactive.perl: Add progress counter in the promptKunal Tyagi via GitGitGadget, Sep 29, 2019
  6. 1/1 git-add--interactive.perl: Add progress counter in the promptKunal Tyagi via GitGitGadget, Sep 29, 2019
  7. Junio C HamanoSep 30, 2019
  8. Johannes SchindelinSep 30, 2019
  9. 0/1 git-add--interactive.perl: Add progress counter in the promptKunal Tyagi via GitGitGadget, Sep 30, 2019
  10. 1/1 add -i: Show progress counter in the promptKunal Tyagi via GitGitGadget, Sep 30, 2019
  11. Junio C HamanoOct 4, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.