Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: René Scharfe <hidden>
Date: 2016-06-15 22:47:45

Possibly related (same subject, not in this thread)

Junio C Hamano schrieb:
quoted hunk ↗ jump to hunk
René Scharfe [off-list ref] writes:
quoted
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é
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help