Skip to content

Commit ebeb39f

Browse files
avargitster
authored andcommitted
git-sh-setup: remove "sane_grep", it's not needed anymore
Remove the sane_grep() shell function in git-sh-setup. The two reasons for why it existed don't apply anymore: 1. It was added due to GNU grep supporting GREP_OPTIONS. See e1622bf (Protect scripted Porcelains from GREP_OPTIONS insanity, 2009-11-23). Newer versions of GNU grep ignore that, but even on older versions its existence won't matter, none of these sane_grep() uses care about grep's output, they're merely using it to check if a string exists in a file or stream. We also don't care about the "LC_ALL=C" that "sane_grep" was using, these greps for fixed or ASCII strings will behave the same under any locale. 2. The SANE_TEXT_GREP added in 71b4010 (sane_grep: pass "-a" if grep accepts it, 2016-03-08) isn't needed either, none of these grep uses deal with binary data. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7927d4 commit ebeb39f

File tree

7 files changed

+4
-22
lines changed

7 files changed

+4
-22
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,6 @@ all::
305305
#
306306
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
307307
#
308-
# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
309-
# and egrep that are pickier when their input contains non-ASCII data.
310-
#
311308
# The TCL_PATH variable governs the location of the Tcl interpreter
312309
# used to optimize git-gui for your system. Only used if NO_TCLTK
313310
# is not set. Defaults to the bare 'tclsh'.
@@ -2254,7 +2251,7 @@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt
22542251

22552252
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
22562253
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
2257-
$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2254+
$(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\
22582255
$(perllibdir_SQ)
22592256
GIT-SCRIPT-DEFINES: FORCE
22602257
@FLAGS='$(SCRIPT_DEFINES)'; \
@@ -2272,7 +2269,6 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
22722269
-e $(BROKEN_PATH_FIX) \
22732270
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
22742271
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
2275-
-e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
22762272
-e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
22772273
22782274
endef

config.mak.uname

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ ifeq ($(uname_S),Linux)
5858
# -lrt is needed for clock_gettime on glibc <= 2.16
5959
NEEDS_LIBRT = YesPlease
6060
HAVE_GETDELIM = YesPlease
61-
SANE_TEXT_GREP=-a
6261
FREAD_READS_DIRECTORIES = UnfortunatelyYes
6362
BASIC_CFLAGS += -DHAVE_SYSINFO
6463
PROCFS_EXECUTABLE_PATH = /proc/self/exe

configure.ac

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,6 @@ if test -n "$ASCIIDOC"; then
507507
esac
508508
fi
509509

510-
if grep -a ascii configure.ac >/dev/null; then
511-
AC_MSG_RESULT([Using 'grep -a' for sane_grep])
512-
SANE_TEXT_GREP=-a
513-
else
514-
SANE_TEXT_GREP=
515-
fi
516-
GIT_CONF_SUBST([SANE_TEXT_GREP])
517-
518510
## Checks for libraries.
519511
AC_MSG_NOTICE([CHECKS for libraries])
520512
#

contrib/buildsystems/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,6 @@ foreach(script ${git_shell_scripts})
781781
string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
782782
string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
783783
string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
784-
string(REPLACE "@@SANE_TEXT_GREP@@" "-a" content "${content}")
785784
string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
786785
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
787786
endforeach()

git-filter-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ if [ "$filter_tag_name" ]; then
579579
git hash-object -t tag -w --stdin) ||
580580
die "Could not create new tag object for $ref"
581581
if git cat-file tag "$ref" | \
582-
sane_grep '^-----BEGIN PGP SIGNATURE-----' >/dev/null 2>&1
582+
grep '^-----BEGIN PGP SIGNATURE-----' >/dev/null 2>&1
583583
then
584584
warn "gpg signature stripped from tag object $sha1t"
585585
fi

git-instaweb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ resolve_full_httpd () {
4949
*apache2*|*lighttpd*|*httpd*)
5050
# yes, *httpd* covers *lighttpd* above, but it is there for clarity
5151
# ensure that the apache2/lighttpd command ends with "-f"
52-
if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1
52+
if ! echo "$httpd" | grep -- '-f *$' >/dev/null 2>&1
5353
then
5454
httpd="$httpd -f"
5555
fi
@@ -399,7 +399,7 @@ EOF
399399
# plain-old CGI
400400
resolve_full_httpd
401401
list_mods=$(echo "$full_httpd" | sed 's/-f$/-l/')
402-
$list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \
402+
$list_mods | grep 'mod_cgi\.c' >/dev/null 2>&1 || \
403403
if test -f "$module_path/mod_cgi.so"
404404
then
405405
echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf"

git-sh-setup.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ git_pager() {
173173
eval "$GIT_PAGER" '"$@"'
174174
}
175175
176-
sane_grep () {
177-
GREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ "$@"
178-
}
179-
180176
is_bare_repository () {
181177
git rev-parse --is-bare-repository
182178
}

0 commit comments

Comments
 (0)