Git fork

t: convert egrep usage to "grep -E"

Despite POSIX states that:

> The old egrep and fgrep commands are likely to be supported for many
> years to come as implementation extensions, allowing historical
> applications to operate unmodified.

GNU grep 3.8 started to warn[1]:

> The egrep and fgrep commands, which have been deprecated since
> release 2.5.3 (2007), now warn that they are obsolescent and should
> be replaced by grep -E and grep -F.

Prepare for their removal in the future.

[1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Đoàn Trần Công Danh and committed by
Junio C Hamano
81580fa0 a764c37b

+29 -29
+2 -2
t/perf/run
··· 232 232 ) 233 233 elif test -n "$GIT_PERF_SUBSECTION" 234 234 then 235 - egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null || 235 + grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null || 236 236 die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'" 237 237 238 - egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec 238 + grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec 239 239 do 240 240 ( 241 241 GIT_PERF_SUBSECTION="$subsec"
+2 -2
t/t1304-default-acl.sh
··· 18 18 if setfacl -m d:m:rwx -m u:root:rwx . && 19 19 getfacl . | grep user:root:rwx && 20 20 touch should-have-readable-acl && 21 - getfacl should-have-readable-acl | egrep "mask::?rw-" 21 + getfacl should-have-readable-acl | grep -E "mask::?rw-" 22 22 then 23 23 test_set_prereq SETFACL 24 24 fi ··· 34 34 getfacl "$1" > actual && 35 35 grep -q "user:root:rwx" actual && 36 36 grep -q "user:${LOGNAME}:rwx" actual && 37 - egrep "mask::?r--" actual > /dev/null 2>&1 && 37 + grep -E "mask::?r--" actual > /dev/null 2>&1 && 38 38 grep -q "group::---" actual || false 39 39 } 40 40
+1 -1
t/t3702-add-edit.sh
··· 100 100 101 101 echo "#!$SHELL_PATH" >fake-editor.sh 102 102 cat >> fake-editor.sh <<\EOF 103 - egrep -v '^index' "$1" >orig-patch && 103 + grep -E -v '^index' "$1" >orig-patch && 104 104 mv -f patch "$1" 105 105 EOF 106 106
+4 -4
t/t4014-format-patch.sh
··· 1457 1457 C=$(git commit-tree HEAD^^{tree} -p HEAD) && 1458 1458 git format-patch --stdout --signoff $C^..$C >append_signoff.patch && 1459 1459 sed -n -e "1,/^---$/p" append_signoff.patch | 1460 - egrep -n "^Subject|Sign|^$" 1460 + grep -E -n "^Subject|Sign|^$" 1461 1461 } 1462 1462 1463 1463 test_expect_success 'signoff: commit with no body' ' ··· 2274 2274 test_expect_success 'format-patch --attach cover-letter only is non-multipart' ' 2275 2275 test_when_finished "rm -fr patches" && 2276 2276 git format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 && 2277 - ! egrep "^--+mimemime" patches/0000*.patch && 2278 - egrep "^--+mimemime$" patches/0001*.patch >output && 2277 + ! grep -E "^--+mimemime" patches/0000*.patch && 2278 + grep -E "^--+mimemime$" patches/0001*.patch >output && 2279 2279 test_line_count = 2 output && 2280 - egrep "^--+mimemime--$" patches/0001*.patch >output && 2280 + grep -E "^--+mimemime--$" patches/0001*.patch >output && 2281 2281 test_line_count = 1 output 2282 2282 ' 2283 2283
+1 -1
t/t5320-delta-islands.sh
··· 134 134 repack -adfi && 135 135 git verify-pack -v .git/objects/pack/*.pack | 136 136 cut -d" " -f1 | 137 - egrep "$root|$two" >actual && 137 + grep -E "$root|$two" >actual && 138 138 test_cmp expect actual 139 139 ' 140 140
+9 -9
t/t7527-builtin-fsmonitor.sh
··· 939 939 # directories and files that we touched. We may or may not get a 940 940 # trailing slash on modified directories. 941 941 # 942 - egrep "^event: abc/?$" ./insensitive.trace && 943 - egrep "^event: abc/def/?$" ./insensitive.trace && 944 - egrep "^event: abc/def/xyz$" ./insensitive.trace 942 + grep -E "^event: abc/?$" ./insensitive.trace && 943 + grep -E "^event: abc/def/?$" ./insensitive.trace && 944 + grep -E "^event: abc/def/xyz$" ./insensitive.trace 945 945 ' 946 946 947 947 # The variable "unicode_debug" is defined in the following library ··· 983 983 then 984 984 # We should have seen NFC event from OS. 985 985 # We should not have synthesized an NFD event. 986 - egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace && 987 - egrep -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace 986 + grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace && 987 + grep -E -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace 988 988 else 989 989 # We should have seen NFD event from OS. 990 990 # We should have synthesized an NFC event. 991 - egrep "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace && 992 - egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace 991 + grep -E "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace && 992 + grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace 993 993 fi && 994 994 995 995 # We assume UNICODE_NFD_PRESERVED. 996 996 # We should have seen explicit NFD from OS. 997 997 # We should have synthesized an NFC event. 998 - egrep "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace && 999 - egrep "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace 998 + grep -E "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace && 999 + grep -E "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace 1000 1000 ' 1001 1001 1002 1002 test_done
+2 -2
t/t7701-repack-unpack-unreachable.sh
··· 35 35 git repack -A -d -l && 36 36 # verify objects are packed in repository 37 37 test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx | 38 - egrep "^($fsha1|$csha1|$tsha1) " | 38 + grep -E "^($fsha1|$csha1|$tsha1) " | 39 39 sort | uniq | wc -l) && 40 40 git show $fsha1 && 41 41 git show $csha1 && ··· 49 49 git repack -A -d -l && 50 50 # verify objects are retained unpacked 51 51 test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx | 52 - egrep "^($fsha1|$csha1|$tsha1) " | 52 + grep -E "^($fsha1|$csha1|$tsha1) " | 53 53 sort | uniq | wc -l) && 54 54 git show $fsha1 && 55 55 git show $csha1 &&
+4 -4
t/t9001-send-email.sh
··· 1519 1519 grep "do not declare a Content-Transfer-Encoding" stdout && 1520 1520 grep email-using-8bit stdout && 1521 1521 grep "Which 8bit encoding" stdout && 1522 - egrep "Content|MIME" msgtxt1 >actual && 1522 + grep -E "Content|MIME" msgtxt1 >actual && 1523 1523 test_cmp content-type-decl actual 1524 1524 ' 1525 1525 ··· 1530 1530 git send-email --from=author@example.com --to=nobody@example.com \ 1531 1531 --smtp-server="$(pwd)/fake.sendmail" \ 1532 1532 email-using-8bit >stdout && 1533 - egrep "Content|MIME" msgtxt1 >actual && 1533 + grep -E "Content|MIME" msgtxt1 >actual && 1534 1534 test_cmp content-type-decl actual 1535 1535 ' 1536 1536 ··· 1545 1545 git send-email --from=author@example.com --to=nobody@example.com \ 1546 1546 --smtp-server="$(pwd)/fake.sendmail" \ 1547 1547 email-using-8bit >stdout && 1548 - egrep "Content|MIME" msgtxt1 >actual && 1548 + grep -E "Content|MIME" msgtxt1 >actual && 1549 1549 test_cmp content-type-decl actual 1550 1550 ' 1551 1551 ··· 1557 1557 --smtp-server="$(pwd)/fake.sendmail" \ 1558 1558 --8bit-encoding=UTF-8 \ 1559 1559 email-using-8bit >stdout && 1560 - egrep "Content|MIME" msgtxt1 >actual && 1560 + grep -E "Content|MIME" msgtxt1 >actual && 1561 1561 test_cmp content-type-decl actual 1562 1562 ' 1563 1563
+1 -1
t/t9814-git-p4-rename.sh
··· 216 216 # variable exists, which allows admins to disable the "p4 move" command. 217 217 test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ' 218 218 p4 configure show run.move.allow >out && 219 - egrep ^run.move.allow: out 219 + grep -E ^run.move.allow: out 220 220 ' 221 221 222 222 # If move can be disabled, turn it off and test p4 move handling
+2 -2
t/t9815-git-p4-submit-fail.sh
··· 417 417 ! p4 fstat -T action text && 418 418 test_path_is_file text+x && 419 419 ! p4 fstat -T action text+x && 420 - ls -l text | egrep ^-r-- && 421 - ls -l text+x | egrep ^-r-x 420 + ls -l text | grep -E ^-r-- && 421 + ls -l text+x | grep -E ^-r-x 422 422 ) 423 423 ' 424 424
+1 -1
t/test-lib-functions.sh
··· 897 897 test_dir_is_empty () { 898 898 test "$#" -ne 1 && BUG "1 param" 899 899 test_path_is_dir "$1" && 900 - if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')" 900 + if test -n "$(ls -a1 "$1" | grep -E -v '^\.\.?$')" 901 901 then 902 902 echo "Directory '$1' is not empty, it contains:" 903 903 ls -la "$1"