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

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

 



Junio C Hamano schrieb:
> René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> 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é
--
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]