Re: [PATCH 2/2] In add --patch, Handle K,k,J,j slightly more gracefully.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



William Pursell <bill.pursell@xxxxxxxxx> 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux