Skip to content

Commit 81580fa

Browse files
sgngitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a764c37 commit 81580fa

11 files changed

+29
-29
lines changed

t/perf/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ then
232232
)
233233
elif test -n "$GIT_PERF_SUBSECTION"
234234
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 ||
236236
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
237237

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
239239
do
240240
(
241241
GIT_PERF_SUBSECTION="$subsec"

t/t1304-default-acl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test_expect_success 'checking for a working acl setup' '
1818
if setfacl -m d:m:rwx -m u:root:rwx . &&
1919
getfacl . | grep user:root:rwx &&
2020
touch should-have-readable-acl &&
21-
getfacl should-have-readable-acl | egrep "mask::?rw-"
21+
getfacl should-have-readable-acl | grep -E "mask::?rw-"
2222
then
2323
test_set_prereq SETFACL
2424
fi
@@ -34,7 +34,7 @@ check_perms_and_acl () {
3434
getfacl "$1" > actual &&
3535
grep -q "user:root:rwx" actual &&
3636
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 &&
3838
grep -q "group::---" actual || false
3939
}
4040

t/t3702-add-edit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ EOF
100100

101101
echo "#!$SHELL_PATH" >fake-editor.sh
102102
cat >> fake-editor.sh <<\EOF
103-
egrep -v '^index' "$1" >orig-patch &&
103+
grep -E -v '^index' "$1" >orig-patch &&
104104
mv -f patch "$1"
105105
EOF
106106

t/t4014-format-patch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ append_signoff()
14571457
C=$(git commit-tree HEAD^^{tree} -p HEAD) &&
14581458
git format-patch --stdout --signoff $C^..$C >append_signoff.patch &&
14591459
sed -n -e "1,/^---$/p" append_signoff.patch |
1460-
egrep -n "^Subject|Sign|^$"
1460+
grep -E -n "^Subject|Sign|^$"
14611461
}
14621462

14631463
test_expect_success 'signoff: commit with no body' '
@@ -2274,10 +2274,10 @@ test_expect_success 'format-patch --base with --attach' '
22742274
test_expect_success 'format-patch --attach cover-letter only is non-multipart' '
22752275
test_when_finished "rm -fr patches" &&
22762276
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 &&
22792279
test_line_count = 2 output &&
2280-
egrep "^--+mimemime--$" patches/0001*.patch >output &&
2280+
grep -E "^--+mimemime--$" patches/0001*.patch >output &&
22812281
test_line_count = 1 output
22822282
'
22832283

t/t5320-delta-islands.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ test_expect_success 'island core places core objects first' '
134134
repack -adfi &&
135135
git verify-pack -v .git/objects/pack/*.pack |
136136
cut -d" " -f1 |
137-
egrep "$root|$two" >actual &&
137+
grep -E "$root|$two" >actual &&
138138
test_cmp expect actual
139139
'
140140

t/t7527-builtin-fsmonitor.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -939,9 +939,9 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
939939
# directories and files that we touched. We may or may not get a
940940
# trailing slash on modified directories.
941941
#
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
945945
'
946946

947947
# The variable "unicode_debug" is defined in the following library
@@ -983,20 +983,20 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
983983
then
984984
# We should have seen NFC event from OS.
985985
# 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
988988
else
989989
# We should have seen NFD event from OS.
990990
# 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
993993
fi &&
994994
995995
# We assume UNICODE_NFD_PRESERVED.
996996
# We should have seen explicit NFD from OS.
997997
# 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
10001000
'
10011001

10021002
test_done

t/t7701-repack-unpack-unreachable.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
3535
git repack -A -d -l &&
3636
# verify objects are packed in repository
3737
test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |
38-
egrep "^($fsha1|$csha1|$tsha1) " |
38+
grep -E "^($fsha1|$csha1|$tsha1) " |
3939
sort | uniq | wc -l) &&
4040
git show $fsha1 &&
4141
git show $csha1 &&
@@ -49,7 +49,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
4949
git repack -A -d -l &&
5050
# verify objects are retained unpacked
5151
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
52-
egrep "^($fsha1|$csha1|$tsha1) " |
52+
grep -E "^($fsha1|$csha1|$tsha1) " |
5353
sort | uniq | wc -l) &&
5454
git show $fsha1 &&
5555
git show $csha1 &&

t/t9001-send-email.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
15191519
grep "do not declare a Content-Transfer-Encoding" stdout &&
15201520
grep email-using-8bit stdout &&
15211521
grep "Which 8bit encoding" stdout &&
1522-
egrep "Content|MIME" msgtxt1 >actual &&
1522+
grep -E "Content|MIME" msgtxt1 >actual &&
15231523
test_cmp content-type-decl actual
15241524
'
15251525

@@ -1530,7 +1530,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
15301530
15311531
--smtp-server="$(pwd)/fake.sendmail" \
15321532
email-using-8bit >stdout &&
1533-
egrep "Content|MIME" msgtxt1 >actual &&
1533+
grep -E "Content|MIME" msgtxt1 >actual &&
15341534
test_cmp content-type-decl actual
15351535
'
15361536

@@ -1545,7 +1545,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding in .git/config overrides --g
15451545
15461546
--smtp-server="$(pwd)/fake.sendmail" \
15471547
email-using-8bit >stdout &&
1548-
egrep "Content|MIME" msgtxt1 >actual &&
1548+
grep -E "Content|MIME" msgtxt1 >actual &&
15491549
test_cmp content-type-decl actual
15501550
'
15511551

@@ -1557,7 +1557,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
15571557
--smtp-server="$(pwd)/fake.sendmail" \
15581558
--8bit-encoding=UTF-8 \
15591559
email-using-8bit >stdout &&
1560-
egrep "Content|MIME" msgtxt1 >actual &&
1560+
grep -E "Content|MIME" msgtxt1 >actual &&
15611561
test_cmp content-type-decl actual
15621562
'
15631563

t/t9814-git-p4-rename.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ test_expect_success 'detect copies' '
216216
# variable exists, which allows admins to disable the "p4 move" command.
217217
test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
218218
p4 configure show run.move.allow >out &&
219-
egrep ^run.move.allow: out
219+
grep -E ^run.move.allow: out
220220
'
221221

222222
# If move can be disabled, turn it off and test p4 move handling

t/t9815-git-p4-submit-fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ test_expect_success 'cleanup chmod after submit cancel' '
417417
! p4 fstat -T action text &&
418418
test_path_is_file text+x &&
419419
! 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
422422
)
423423
'
424424

0 commit comments

Comments
 (0)