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

Re: [PATCH] unset GREP_OPTIONS in test-lib.sh

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Nov 23, 2009, 23:59 UTC
Message-ID
<4B0B21CF.5040504@lsrfire.ath.cx>
In-Reply-To
<7v4ooku7cv.fsf@alter.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 48 quoted lines
> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
> 
>> Yes, but what about git commands that are implemented as shell scripts
>> and use grep?  Something like the following patch?
>>
>> We'd need to run this from time to time to make sure no new grep calls
>> creep in:
>>
>>    git grep -L "unset GREP_OPTIONS" -- $(git grep -l "grep" git-*.sh)
> 
> Hmm, but "bisect run" runs user's script and it may want to see
> GREP_OPTIONS from the environment, no?  Same for any of the hooks that am
> and rebase might want to run.
> 
> 
> 
>  git-sh-setup.sh            |   14 ++++++++++++++
>  git-am.sh                  |    4 ++--
>  git-bisect.sh              |    4 ++--
>  git-filter-branch.sh       |    2 +-
>  git-instaweb.sh            |    8 ++++----
>  git-rebase--interactive.sh |   10 +++++-----
>  git-rebase.sh              |    2 +-
>  git-submodule.sh           |    6 +++---
>  8 files changed, 32 insertions(+), 18 deletions(-)
> 
> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
> index c41c2f7..2b2afa6 100755
> --- a/git-sh-setup.sh
> +++ b/git-sh-setup.sh
> @@ -114,6 +114,20 @@ git_editor() {
>  	eval "${GIT_EDITOR:=vi}" '"$@"'
>  }
>  
> +sane_grep () {
> +	GREP_OPTIONS= \
> +	GREP_COLOR= \
> +	GREP_COLORS= \
> +	LC_ALL=C grep "$@"
> +}
> +
> +sane_egrep () {
> +	GREP_OPTIONS= \
> +	GREP_COLOR= \
> +	GREP_COLORS= \
> +	LC_ALL=C egrep "$@"
> +}
> +
Ah, yes, much nicer.
René
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 12 in “unset GREP_OPTIONS in test-lib.sh”
  1. unset GREP_OPTIONS in test-lib.shBert Wesarg, Nov 18, 2009
  2. Junio C HamanoNov 18, 2009
  3. René ScharfeNov 22, 2009
  4. Carlo Marcelo Arenas BelonNov 23, 2009
  5. Junio C HamanoNov 23, 2009
  6. René ScharfeNov 23, 2009
  7. mergetool--lib: simplify guess_merge_tool()René Scharfe, Nov 23, 2009
  8. David AguilarNov 27, 2009
  9. Junio C HamanoNov 23, 2009
  10. René ScharfeNov 23, 2009
  11. Junio C HamanoNov 24, 2009
  12. Bert WesargMar 7, 2010

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.