Subject: bug#53889: 29.0.50; obsolete git-sh-setup function sane_egrep in pre-commit hook

From: "J.P." <[email-masked]>
Date: Tue, 08 Feb 2022 19:30:19 -0800

Severity: minor

Hi, I stumbled on this by accident after leaving a recent build of the
Git suite in my PATH and trying to apply some Emacs patches with git-am.
The patches still applied despite a warning being emitted:

  .git/hooks/pre-applypatch: line 48: sane_egrep: command not found

I believe the breaking change[1] (in git.git) was first included[2] in
release v2.35.0[3]. Browsing around, it looks like only bleeding edge
distributions have begun packaging this Git release[4]. There's likely
still some time before it starts affecting most of us. Thanks.

[1] https://github.com/git/git/commit/ebeb39faad6e3a67c31884c3dc6b76ce58b3f15b

    commit ebeb39faad6e3a67c31884c3dc6b76ce58b3f15b
    Author: Ævar Arnfjörð Bjarmason <[email-masked]>
    Date:   Thu Oct 21 21:58:00 2021 +0200
    
        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
           e1622bfcbad (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 71b401032b9 (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-masked]>
        Signed-off-by: Junio C Hamano <[email-masked]>

[2] https://github.com/git/git/commit/ad1260b6c994f7c0f9c259bd39f39979f7f4ecc2

    Merge branch 'ab/sh-retire-helper-functions'

[3] https://github.com/git/git/commit/89bece5c8c96f0b962cfc89e63f82d603fd60bed

    commit 89bece5c8c96f0b962cfc89e63f82d603fd60bed (tag: v2.35.0)
    Author: Junio C Hamano <[email-masked]>
    Date:   Mon Jan 24 09:25:25 2022 -0800

       Git 2.35

       Signed-off-by: Junio C Hamano <[email-masked]>

[4] https://github.com/archlinux/svntogit-packages/commit/6d64d752
    https://src.fedoraproject.org/rpms/git/blob/rawhide/f/git.spec#_86

In GNU Emacs 29.0.50 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.31, cairo version 1.17.4)
 of 2022-02-04 built on localhost
Repository revision: 97966c5154bb842a3e5d04a003feadf7d761259b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 35 (Workstation Edition)

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu
 --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
 --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
 --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec
 --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz
 --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-O0 -g3'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date seq gv
subr-x byte-opt bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 44979 11627)
 (symbols 48 5690 1)
 (strings 32 15812 2354)
 (string-bytes 1 523893)
 (vectors 16 12816)
 (vector-slots 8 173470 33427)
 (floats 8 20 34)
 (intervals 56 261 0)
 (buffers 992 10))