Re: [PATCH 1/2] Add / command in add --patch (feature request)

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

 



Junio C Hamano wrote:


Use of eval is a good way to protect against this kind of breakage, but it
should be done close to where the string is given by the user, perhaps in
here:


+			elsif ($line =~ m|^/(.*)|) {
+				$search_s = $1;
+			}

Something like...

	elsif ($line =~ m|^/(.*)|) {
        	$search_string = $1;
                eval {
                	$search_string =~ /$search_string/;
		};
                if ($@) {
                	print STDERR "Regexp error in $search_string: $@";
			next;
		}
	...

Thanks.  The second set of patches that I just sent
up is fatally flawed--by changing to skip unmatched
hunks instead of deselecting them, it enters a loop
if no hunks match.

Before working on patches, I'd like some ideas on
functionality:

1) If a hunk doesn't match, should it be as if the user
   selected 'n', or 'j'?
2) If no hunks match it is easiest to simply move to
   the last hunk and display it, but I'm not sure that
   is acceptable.  Probably better to return to the
   hunk that was being viewed when the search string
   is entered, but that seems to require some restructuring
   of the code.  What would be the preferred behavior?



--
William Pursell
--
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