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

Re: [PATCH] git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 8, 2009, 06:54 UTC
Message-ID
<7vmy56gc4x.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090908064756.GA14155@sajinet.com.pe>
Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe> writes:
Show 7 quoted lines
> On Mon, Sep 07, 2009 at 12:37:30PM -0700, Junio C Hamano wrote:
>> 
>> How does your patch help when the user has GREP_OPTIONS=-C3 in the
>> environment?
>
> It wouldn't help but at least wouldn't break aborting with an script
> error since you will always get a number.
That's actually worse, don't you think?

It is trying to count how many actions are done and how many are remaining, and if you miscount it in that shell function, you will get incorrect result. The function happens to be merely for reporting, but the point is that it is better to fail loudly than doing wrong thing.

Show 7 quoted lines
>> I think a saner workaround for this user environment bug (or GNU grep
>> misfeature) is to unset GREP_OPTIONS at the beginning of the script, or
>> even in git-sh-setup.
>
> agree, and since grep is used almost everywhere filtering in git-sh-setup
> like CDPATH is makes sense, with the only user of grep that wouldn't
> benefit from that being git-mergetool--lib.sh AFAIK.

Not at all. "git grep" itself will be broken. See my other patch for a possible alternative approach.

Previous: Carlo Marcelo Arenas BelonNext: Junio C Hamano
Message 5 of 7 in “git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"”
  1. git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"Carlo Marcelo Arenas Belon, Sep 7, 2009
  2. Dave RodgmanSep 7, 2009
  3. Junio C HamanoSep 7, 2009
  4. Carlo Marcelo Arenas BelonSep 8, 2009
  5. Junio C HamanoSep 8, 2009
  6. Junio C HamanoSep 8, 2009
  7. Carlo Marcelo Arenas BelonSep 8, 2009

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.