git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] add -p: fix 2.17.0-rc* regression due to moved code

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 1, 2018, 05:00 UTC
Message-ID
<xmqqbmf31pxx.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180331125058.4506-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 14 quoted lines
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index d190469cd8..c1f52e457f 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -1561,13 +1561,13 @@ sub patch_update_file {
>  			elsif ($line =~ m|^/(.*)|) {
>  				my $regex = $1;
>  				unless ($other =~ m|/|) {
>  					error_msg __("No other hunks to search\n");
>  					next;
>  				}
> -				if ($1 eq "") {
> +				if ($regex eq "") {
>  					print colored $prompt_color, __("search for regex? ");

Ah. That "unless ... { }" thing is what was inserted recently, and the patch is an obvious fix once the problem is pointed out. Thanks for a careful reading.

It makes me wonder what the original author, who already captured $1 in $regex, was thinking when he wrote the comparison with $1 there, but that is OK---ithappend long time ago in early 2009.

Will apply.  Thanks.
Show 5 quoted lines
>  					$regex = <STDIN>;
>  					if (defined $regex) {
>  						chomp $regex;
>  					}
>  				}
Previous: Ævar Arnfjörð Bjarmason
Message 9 of 9 in “add -p: improve help messages”
  1. 0/3 add -p: improve help messagesPhillip Wood, Feb 13, 2018
  2. 3/3 add -p: improve error messagesPhillip Wood, Feb 13, 2018
  3. 1/3 add -p: only display help for active keysPhillip Wood, Feb 13, 2018
  4. 2/3 add -p: Only bind search key if there's more than one hunkPhillip Wood, Feb 13, 2018
  5. add -p: fix 2.17.0-rc* regression due to moved codeÆvar Arnfjörð Bjarmason, Mar 31, 2018
  6. add -p: fix 2.17.0-rc* regression due to moved codeÆvar Arnfjörð Bjarmason, Mar 31, 2018
  7. Phillip WoodMar 31, 2018
  8. Ævar Arnfjörð BjarmasonMar 31, 2018
  9. Junio C HamanoApr 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.