From: Junio C Hamano <gitster@pobox.com>
To: William Pursell <bill.pursell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] Add / command in add --patch (feature request)
Date: Wed, 26 Nov 2008 13:55:16 -0800 [thread overview]
Message-ID: <7vljv6duez.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 492DB6C8.7010205@gmail.com
William Pursell <bill.pursell@gmail.com> writes:
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index b0223c3..7ad4ee0 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -876,12 +876,14 @@ sub patch_update_file {
>
> $num = scalar @hunk;
> $ix = 0;
> + my $search_s; # User entered string to match a hunk.
>
> while (1) {
> my ($prev, $next, $other, $undecided, $i);
> $other = '';
>
> if ($num <= $ix) {
> + $search_s = 0;
People cannot look for string "0"?
Instead, set this to 'undef' and check with:
if (defined $search_string) {
...
in the later part of the code.
> @@ -916,11 +918,24 @@ sub patch_update_file {
> $other .= '/s';
> }
> $other .= '/e';
> - for (@{$hunk[$ix]{DISPLAY}}) {
> - print;
> +
> + my $line;
> + if( $search_s ) {
> + my $text = join( "", @{$hunk[$ix]{DISPLAY}} );
> + if( $text !~ $search_s ) {
Style.
(1) SP between language construct and open parenthesis, as opposed to
no extra SP between function name and open parenthesis;
(2) No extra SP around what is enclosed in parentheses.
No help text added to help people discover this new feature?
The interactive help prompt is hard to read because '/' is used to
separate choices. I'd suggest to make this into two patches:
Patch 1/2 would change use of '/' to ',' so that this:
Stage this hunk [y/n/a/d/j/J/e/?]?
becomes
Stage this hunk [y,n,a,d,j,J,e,?]?
Patch 2/2 would be a fix-up of the patch you sent.
Thanks.
next prev parent reply other threads:[~2008-11-26 21:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 20:51 [PATCH 1/2] Add / command in add --patch (feature request) William Pursell
2008-11-26 21:55 ` Junio C Hamano [this message]
2008-11-26 22:38 ` Jeff King
2008-11-26 22:54 ` Junio C Hamano
2008-11-27 6:02 ` William Pursell
2008-11-27 6:41 ` Junio C Hamano
2008-11-27 1:46 ` Johannes Schindelin
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=7vljv6duez.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.