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

[PATCH] Print hunk number in prompt of add --patch.

From
William Pursell <bill.pursell@gmail.com>
Date
Nov 27, 2008, 06:17 UTC
Message-ID
<492E3B6D.9090309@gmail.com>

I'm considering adding a command to skip to a hunk, and just generally find myself confused about which hunk I'm looking at, so having the number in the prompt is helpful.

Signed-off-by: William Pursell <bill.pursell@gmail.com>
---
  git-add--interactive.perl |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index b0223c3..7974cd1 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -919,7 +919,7 @@ sub patch_update_file {
  		for (@{$hunk[$ix]{DISPLAY}}) {
  			print;
  		}
-		print colored $prompt_color, "Stage this hunk [y/n/a/d$other/?]? ";
+		print colored $prompt_color, "Stage hunk $ix [y/n/a/d$other/?]? ";
  		my $line = <STDIN>;
  		if ($line) {
  			if ($line =~ /^y/i) {
-- 
1.6.0.4.782.geea74.dirty


-- 
William Pursell
Next: Junio C Hamano
Message 1 of 2 in “Print hunk number in prompt of add --patch.”
  1. Print hunk number in prompt of add --patch.William Pursell, Nov 27, 2008
  2. Junio C HamanoNov 27, 2008

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.