From: Junio C Hamano <gitster@pobox.com>
To: William Pursell <bill.pursell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] In add --patch, Handle K,k,J,j slightly more gracefully.
Date: Wed, 26 Nov 2008 13:55:47 -0800 [thread overview]
Message-ID: <7vej0ydue4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 492DB6CE.3010409@gmail.com
William Pursell <bill.pursell@gmail.com> writes:
> Instead of printing the help menu, this will print
> "No next hunk" and then process the given hunk again.
> ---
Missing sign-off.
> - elsif ($other =~ /K/ && $line =~ /^K/) {
> - $ix--;
> + elsif ( $line =~ /^K/) {
> + $other =~ /K/ ? $ix-- : print STDERR "No previous hunk\n";
This may be cute but I think it is harder to read than necessary.
if ($other =~ /K/) {
$ix--;
} else {
print STDERR "No previous hunk\n";
}
> + elsif ($line =~ /^k/) {
> + if ($other =~ /k/) {
> + while (1) {
> + $ix--;
> + last if (!$ix ||
> + !defined $hunk[$ix]{USE});
> + }
> + next;
> + }
> + else {
> + print STDERR "No previous hunk\n";
> }
> - next;
> }
> + elsif ($line =~ /^j/) {
> + if ($other !~ /j/) {
> + print STDERR "No next hunk\n";
> + next;
> }
> }
Doesn't this behave differently against an unavailable 'k' and 'j'? When
the user says 'j' when no next hunk is available, it will ask again about
that hunk, but when the user says 'k' at the first hunk, because you
discarded 'next', it will ask about the next hunk, no? Shouldn't it ask
again about the same hunk, against which the user gave an erroneous input?
prev parent reply other threads:[~2008-11-26 21:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 20:51 [PATCH 2/2] In add --patch, Handle K,k,J,j slightly more gracefully William Pursell
2008-11-26 21:55 ` 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=7vej0ydue4.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).