git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: William Pursell <bill.pursell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Print hunk number in prompt of add --patch.
Date: Wed, 26 Nov 2008 23:14:26 -0800	[thread overview]
Message-ID: <7vwsepbpyl.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <492E3B6D.9090309@gmail.com> (William Pursell's message of "Thu, 27 Nov 2008 06:17:17 +0000")

William Pursell <bill.pursell@gmail.com> writes:

> 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) {

Do we know how many hunks we have at this point (and remember we need to
adjust the number of hunks after splitting)?

The original one was unfriendly in that it asked "Do you want this or not?
We'd rather not to say where you are nor how many more there are".  Your
update is slightly better but not enough: "Do you want this one or not?
It is the second one but we still won't tell you how many more there are".

I'd prefer it to ask "Stage hunk 2 (of 35)?" if you are adding more words
here.

I doubt "jump to hunk specified by hunk number" is useful in general.  You
wouldn't know what hunk number the hunk you are interested in has, until
you scroll through them all.

"Jump to hunk around line number X in the preimage", or "jump to a hunk in
function Y" may be useful (the latter you can do with "/^@@.*funcname"
with your slash-search patch).

      reply	other threads:[~2008-11-27  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27  6:17 [PATCH] Print hunk number in prompt of add --patch William Pursell
2008-11-27  7:14 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwsepbpyl.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bill.pursell@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).