From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Michael J Gruber" <git@drmicha.warpmail.net>,
"Torsten Bögershausen" <tboegi@web.de>,
"Anders Kaseorg" <andersk@mit.edu>,
git@vger.kernel.org
Subject: Re: [PATCH] rebase -p: avoid grep on potentailly non-ASCII data
Date: Tue, 08 Mar 2016 15:20:26 -0800 [thread overview]
Message-ID: <xmqqio0wk151.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160308143556.GA10153@sigill.intra.peff.net> (Jeff King's message of "Tue, 8 Mar 2016 09:35:56 -0500")
Jeff King <peff@peff.net> writes:
> I actually wonder if we should have a build-time knob to put "grep -a"
> into sane_grep(). We do not ever plan to feed it binary data, so that
> will do what, provided the system grep handles "-a". And on those that
> do not know about "-a", one imagines that they do not suffer from this
> problem in the first place (which is really limited to recent versions
> of GNU grep).
Something along this line, you mean? I'll leave it as a
low-hanging-fruit to add autoconf support ;-)
Makefile | 4 ++++
git-sh-setup.sh | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 24bef8d..1187498 100644
--- a/Makefile
+++ b/Makefile
@@ -264,6 +264,9 @@ all::
#
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
+# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
+# and egrep that are picker when their input contains non-ASCII data.
+#
# The TCL_PATH variable governs the location of the Tcl interpreter
# used to optimize git-gui for your system. Only used if NO_TCLTK
# is not set. Defaults to the bare 'tclsh'.
@@ -1752,6 +1755,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e $(BROKEN_PATH_FIX) \
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
+ -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
$@.sh >$@+
endef
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 4691fbc..c48139a 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -168,11 +168,11 @@ git_pager() {
}
sane_grep () {
- GREP_OPTIONS= LC_ALL=C grep "$@"
+ GREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ "$@"
}
sane_egrep () {
- GREP_OPTIONS= LC_ALL=C egrep "$@"
+ GREP_OPTIONS= LC_ALL=C egrep @@SANE_TEXT_GREP@@ "$@"
}
is_bare_repository () {
next prev parent reply other threads:[~2016-03-08 23:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 7:59 [PATCH] rebase -p: avoid grep on potentailly non-ASCII data Anders Kaseorg
2016-03-08 12:25 ` Torsten Bögershausen
2016-03-08 13:45 ` Michael J Gruber
2016-03-08 14:35 ` Jeff King
2016-03-08 23:20 ` Junio C Hamano [this message]
2016-03-08 23:36 ` Junio C Hamano
2016-03-09 0:11 ` Jeff King
2016-03-09 0:10 ` Jeff King
2016-03-09 2:31 ` Anders Kaseorg
2016-03-09 20:26 ` Junio C Hamano
2016-03-10 7:42 ` Torsten Bögershausen
2016-03-10 17:22 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqio0wk151.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=andersk@mit.edu \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.