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>
This commit is contained in:
parent
a764c37bad
commit
81580fa06d
@ -232,10 +232,10 @@ then
|
|||||||
)
|
)
|
||||||
elif test -n "$GIT_PERF_SUBSECTION"
|
elif test -n "$GIT_PERF_SUBSECTION"
|
||||||
then
|
then
|
||||||
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
|
grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
|
||||||
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
|
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
|
||||||
|
|
||||||
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
|
grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
|
||||||
do
|
do
|
||||||
(
|
(
|
||||||
GIT_PERF_SUBSECTION="$subsec"
|
GIT_PERF_SUBSECTION="$subsec"
|
||||||
|
@ -18,7 +18,7 @@ test_expect_success 'checking for a working acl setup' '
|
|||||||
if setfacl -m d:m:rwx -m u:root:rwx . &&
|
if setfacl -m d:m:rwx -m u:root:rwx . &&
|
||||||
getfacl . | grep user:root:rwx &&
|
getfacl . | grep user:root:rwx &&
|
||||||
touch should-have-readable-acl &&
|
touch should-have-readable-acl &&
|
||||||
getfacl should-have-readable-acl | egrep "mask::?rw-"
|
getfacl should-have-readable-acl | grep -E "mask::?rw-"
|
||||||
then
|
then
|
||||||
test_set_prereq SETFACL
|
test_set_prereq SETFACL
|
||||||
fi
|
fi
|
||||||
@ -34,7 +34,7 @@ check_perms_and_acl () {
|
|||||||
getfacl "$1" > actual &&
|
getfacl "$1" > actual &&
|
||||||
grep -q "user:root:rwx" actual &&
|
grep -q "user:root:rwx" actual &&
|
||||||
grep -q "user:${LOGNAME}:rwx" actual &&
|
grep -q "user:${LOGNAME}:rwx" actual &&
|
||||||
egrep "mask::?r--" actual > /dev/null 2>&1 &&
|
grep -E "mask::?r--" actual > /dev/null 2>&1 &&
|
||||||
grep -q "group::---" actual || false
|
grep -q "group::---" actual || false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ EOF
|
|||||||
|
|
||||||
echo "#!$SHELL_PATH" >fake-editor.sh
|
echo "#!$SHELL_PATH" >fake-editor.sh
|
||||||
cat >> fake-editor.sh <<\EOF
|
cat >> fake-editor.sh <<\EOF
|
||||||
egrep -v '^index' "$1" >orig-patch &&
|
grep -E -v '^index' "$1" >orig-patch &&
|
||||||
mv -f patch "$1"
|
mv -f patch "$1"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -1457,7 +1457,7 @@ append_signoff()
|
|||||||
C=$(git commit-tree HEAD^^{tree} -p HEAD) &&
|
C=$(git commit-tree HEAD^^{tree} -p HEAD) &&
|
||||||
git format-patch --stdout --signoff $C^..$C >append_signoff.patch &&
|
git format-patch --stdout --signoff $C^..$C >append_signoff.patch &&
|
||||||
sed -n -e "1,/^---$/p" append_signoff.patch |
|
sed -n -e "1,/^---$/p" append_signoff.patch |
|
||||||
egrep -n "^Subject|Sign|^$"
|
grep -E -n "^Subject|Sign|^$"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'signoff: commit with no body' '
|
test_expect_success 'signoff: commit with no body' '
|
||||||
@ -2274,10 +2274,10 @@ test_expect_success 'format-patch --base with --attach' '
|
|||||||
test_expect_success 'format-patch --attach cover-letter only is non-multipart' '
|
test_expect_success 'format-patch --attach cover-letter only is non-multipart' '
|
||||||
test_when_finished "rm -fr patches" &&
|
test_when_finished "rm -fr patches" &&
|
||||||
git format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 &&
|
git format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 &&
|
||||||
! egrep "^--+mimemime" patches/0000*.patch &&
|
! grep -E "^--+mimemime" patches/0000*.patch &&
|
||||||
egrep "^--+mimemime$" patches/0001*.patch >output &&
|
grep -E "^--+mimemime$" patches/0001*.patch >output &&
|
||||||
test_line_count = 2 output &&
|
test_line_count = 2 output &&
|
||||||
egrep "^--+mimemime--$" patches/0001*.patch >output &&
|
grep -E "^--+mimemime--$" patches/0001*.patch >output &&
|
||||||
test_line_count = 1 output
|
test_line_count = 1 output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ test_expect_success 'island core places core objects first' '
|
|||||||
repack -adfi &&
|
repack -adfi &&
|
||||||
git verify-pack -v .git/objects/pack/*.pack |
|
git verify-pack -v .git/objects/pack/*.pack |
|
||||||
cut -d" " -f1 |
|
cut -d" " -f1 |
|
||||||
egrep "$root|$two" >actual &&
|
grep -E "$root|$two" >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -939,9 +939,9 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
|
|||||||
# directories and files that we touched. We may or may not get a
|
# directories and files that we touched. We may or may not get a
|
||||||
# trailing slash on modified directories.
|
# trailing slash on modified directories.
|
||||||
#
|
#
|
||||||
egrep "^event: abc/?$" ./insensitive.trace &&
|
grep -E "^event: abc/?$" ./insensitive.trace &&
|
||||||
egrep "^event: abc/def/?$" ./insensitive.trace &&
|
grep -E "^event: abc/def/?$" ./insensitive.trace &&
|
||||||
egrep "^event: abc/def/xyz$" ./insensitive.trace
|
grep -E "^event: abc/def/xyz$" ./insensitive.trace
|
||||||
'
|
'
|
||||||
|
|
||||||
# The variable "unicode_debug" is defined in the following library
|
# The variable "unicode_debug" is defined in the following library
|
||||||
@ -983,20 +983,20 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
|
|||||||
then
|
then
|
||||||
# We should have seen NFC event from OS.
|
# We should have seen NFC event from OS.
|
||||||
# We should not have synthesized an NFD event.
|
# We should not have synthesized an NFD event.
|
||||||
egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
|
grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
|
||||||
egrep -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
|
grep -E -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
|
||||||
else
|
else
|
||||||
# We should have seen NFD event from OS.
|
# We should have seen NFD event from OS.
|
||||||
# We should have synthesized an NFC event.
|
# We should have synthesized an NFC event.
|
||||||
egrep "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
|
grep -E "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
|
||||||
egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
|
grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
|
||||||
fi &&
|
fi &&
|
||||||
|
|
||||||
# We assume UNICODE_NFD_PRESERVED.
|
# We assume UNICODE_NFD_PRESERVED.
|
||||||
# We should have seen explicit NFD from OS.
|
# We should have seen explicit NFD from OS.
|
||||||
# We should have synthesized an NFC event.
|
# We should have synthesized an NFC event.
|
||||||
egrep "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
|
grep -E "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
|
||||||
egrep "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
|
grep -E "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -35,7 +35,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
|
|||||||
git repack -A -d -l &&
|
git repack -A -d -l &&
|
||||||
# verify objects are packed in repository
|
# verify objects are packed in repository
|
||||||
test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
||||||
egrep "^($fsha1|$csha1|$tsha1) " |
|
grep -E "^($fsha1|$csha1|$tsha1) " |
|
||||||
sort | uniq | wc -l) &&
|
sort | uniq | wc -l) &&
|
||||||
git show $fsha1 &&
|
git show $fsha1 &&
|
||||||
git show $csha1 &&
|
git show $csha1 &&
|
||||||
@ -49,7 +49,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
|
|||||||
git repack -A -d -l &&
|
git repack -A -d -l &&
|
||||||
# verify objects are retained unpacked
|
# verify objects are retained unpacked
|
||||||
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
||||||
egrep "^($fsha1|$csha1|$tsha1) " |
|
grep -E "^($fsha1|$csha1|$tsha1) " |
|
||||||
sort | uniq | wc -l) &&
|
sort | uniq | wc -l) &&
|
||||||
git show $fsha1 &&
|
git show $fsha1 &&
|
||||||
git show $csha1 &&
|
git show $csha1 &&
|
||||||
|
@ -1519,7 +1519,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
|
|||||||
grep "do not declare a Content-Transfer-Encoding" stdout &&
|
grep "do not declare a Content-Transfer-Encoding" stdout &&
|
||||||
grep email-using-8bit stdout &&
|
grep email-using-8bit stdout &&
|
||||||
grep "Which 8bit encoding" stdout &&
|
grep "Which 8bit encoding" stdout &&
|
||||||
egrep "Content|MIME" msgtxt1 >actual &&
|
grep -E "Content|MIME" msgtxt1 >actual &&
|
||||||
test_cmp content-type-decl actual
|
test_cmp content-type-decl actual
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -1530,7 +1530,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
|
|||||||
git send-email --from=author@example.com --to=nobody@example.com \
|
git send-email --from=author@example.com --to=nobody@example.com \
|
||||||
--smtp-server="$(pwd)/fake.sendmail" \
|
--smtp-server="$(pwd)/fake.sendmail" \
|
||||||
email-using-8bit >stdout &&
|
email-using-8bit >stdout &&
|
||||||
egrep "Content|MIME" msgtxt1 >actual &&
|
grep -E "Content|MIME" msgtxt1 >actual &&
|
||||||
test_cmp content-type-decl actual
|
test_cmp content-type-decl actual
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding in .git/config overrides --g
|
|||||||
git send-email --from=author@example.com --to=nobody@example.com \
|
git send-email --from=author@example.com --to=nobody@example.com \
|
||||||
--smtp-server="$(pwd)/fake.sendmail" \
|
--smtp-server="$(pwd)/fake.sendmail" \
|
||||||
email-using-8bit >stdout &&
|
email-using-8bit >stdout &&
|
||||||
egrep "Content|MIME" msgtxt1 >actual &&
|
grep -E "Content|MIME" msgtxt1 >actual &&
|
||||||
test_cmp content-type-decl actual
|
test_cmp content-type-decl actual
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -1557,7 +1557,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
|
|||||||
--smtp-server="$(pwd)/fake.sendmail" \
|
--smtp-server="$(pwd)/fake.sendmail" \
|
||||||
--8bit-encoding=UTF-8 \
|
--8bit-encoding=UTF-8 \
|
||||||
email-using-8bit >stdout &&
|
email-using-8bit >stdout &&
|
||||||
egrep "Content|MIME" msgtxt1 >actual &&
|
grep -E "Content|MIME" msgtxt1 >actual &&
|
||||||
test_cmp content-type-decl actual
|
test_cmp content-type-decl actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ test_expect_success 'detect copies' '
|
|||||||
# variable exists, which allows admins to disable the "p4 move" command.
|
# variable exists, which allows admins to disable the "p4 move" command.
|
||||||
test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
|
test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
|
||||||
p4 configure show run.move.allow >out &&
|
p4 configure show run.move.allow >out &&
|
||||||
egrep ^run.move.allow: out
|
grep -E ^run.move.allow: out
|
||||||
'
|
'
|
||||||
|
|
||||||
# If move can be disabled, turn it off and test p4 move handling
|
# If move can be disabled, turn it off and test p4 move handling
|
||||||
|
@ -417,8 +417,8 @@ test_expect_success 'cleanup chmod after submit cancel' '
|
|||||||
! p4 fstat -T action text &&
|
! p4 fstat -T action text &&
|
||||||
test_path_is_file text+x &&
|
test_path_is_file text+x &&
|
||||||
! p4 fstat -T action text+x &&
|
! p4 fstat -T action text+x &&
|
||||||
ls -l text | egrep ^-r-- &&
|
ls -l text | grep -E ^-r-- &&
|
||||||
ls -l text+x | egrep ^-r-x
|
ls -l text+x | grep -E ^-r-x
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ test_path_is_symlink () {
|
|||||||
test_dir_is_empty () {
|
test_dir_is_empty () {
|
||||||
test "$#" -ne 1 && BUG "1 param"
|
test "$#" -ne 1 && BUG "1 param"
|
||||||
test_path_is_dir "$1" &&
|
test_path_is_dir "$1" &&
|
||||||
if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
|
if test -n "$(ls -a1 "$1" | grep -E -v '^\.\.?$')"
|
||||||
then
|
then
|
||||||
echo "Directory '$1' is not empty, it contains:"
|
echo "Directory '$1' is not empty, it contains:"
|
||||||
ls -la "$1"
|
ls -la "$1"
|
||||||
|
Loading…
Reference in New Issue
Block a user