{"thread":{"id":"16493","subject":"[PATCH] Print hunk number in prompt of add --patch.","startedAt":"2008-11-27T06:17:17Z","lastAt":"2008-11-27T07:14:26Z","messageCount":2,"participants":["William Pursell","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"96604","messageId":"492E3B6D.9090309@gmail.com","threadId":"16493","inReplyTo":null,"subject":"[PATCH] Print hunk number in prompt of add --patch.","fromName":"William Pursell","fromEmail":"bill.pursell@gmail.com","sentAt":"2008-11-27T06:17:17Z","receivedAt":"2008-11-27T06:17:17Z","isPatch":true,"sender":{"key":"bill.pursell@gmail.com","avatar":"https://gravatar.com/avatar/3ab4313e5dfdc1fedb65206d829ba33f71f56f26e11326979d1b99d5e1c403c9?d=mp&s=160"},"body":"\nI'm considering adding a command to skip to a hunk, and\njust generally find myself confused about which hunk I'm\nlooking at, so having the number in the prompt is helpful.\n\nSigned-off-by: William Pursell <bill.pursell@gmail.com>\n---\n  git-add--interactive.perl |    2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex b0223c3..7974cd1 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -919,7 +919,7 @@ sub patch_update_file {\n  \t\tfor (@{$hunk[$ix]{DISPLAY}}) {\n  \t\t\tprint;\n  \t\t}\n-\t\tprint colored $prompt_color, \"Stage this hunk [y/n/a/d$other/?]? \";\n+\t\tprint colored $prompt_color, \"Stage hunk $ix [y/n/a/d$other/?]? \";\n  \t\tmy $line = <STDIN>;\n  \t\tif ($line) {\n  \t\t\tif ($line =~ /^y/i) {\n-- \n1.6.0.4.782.geea74.dirty\n\n\n-- \nWilliam Pursell\n"},{"id":"96606","messageId":"7vwsepbpyl.fsf@gitster.siamese.dyndns.org","threadId":"16493","inReplyTo":"492E3B6D.9090309@gmail.com","subject":"Re: [PATCH] Print hunk number in prompt of add --patch.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-27T07:14:26Z","receivedAt":"2008-11-27T07:14:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"William Pursell <bill.pursell@gmail.com> writes:\n\n> diff --git a/git-add--interactive.perl b/git-add--interactive.perl\n> index b0223c3..7974cd1 100755\n> --- a/git-add--interactive.perl\n> +++ b/git-add--interactive.perl\n> @@ -919,7 +919,7 @@ sub patch_update_file {\n>  \t\tfor (@{$hunk[$ix]{DISPLAY}}) {\n>  \t\t\tprint;\n>  \t\t}\n> -\t\tprint colored $prompt_color, \"Stage this hunk [y/n/a/d$other/?]? \";\n> +\t\tprint colored $prompt_color, \"Stage hunk $ix [y/n/a/d$other/?]? \";\n>  \t\tmy $line = <STDIN>;\n>  \t\tif ($line) {\n>  \t\t\tif ($line =~ /^y/i) {\n\nDo we know how many hunks we have at this point (and remember we need to\nadjust the number of hunks after splitting)?\n\nThe original one was unfriendly in that it asked \"Do you want this or not?\nWe'd rather not to say where you are nor how many more there are\".  Your\nupdate is slightly better but not enough: \"Do you want this one or not?\nIt is the second one but we still won't tell you how many more there are\".\n\nI'd prefer it to ask \"Stage hunk 2 (of 35)?\" if you are adding more words\nhere.\n\nI doubt \"jump to hunk specified by hunk number\" is useful in general.  You\nwouldn't know what hunk number the hunk you are interested in has, until\nyou scroll through them all.\n\n\"Jump to hunk around line number X in the preimage\", or \"jump to a hunk in\nfunction Y\" may be useful (the latter you can do with \"/^@@.*funcname\"\nwith your slash-search patch).\n"}]}