Skip to content

Commit de73968

Browse files
committed
Merge branch 'dd/retire-efgrep'
Prepare for GNU [ef]grep that throw warning of their uses. * dd/retire-efgrep: t: convert fgrep usage to "grep -F" t: convert egrep usage to "grep -E" t: remove \{m,n\} from BRE grep usage CodingGuidelines: allow grep -E
2 parents 410a0e5 + 37eb90f commit de73968

23 files changed

+53
-55
lines changed

Documentation/CodingGuidelines

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ For shell scripts specifically (not exhaustive):
162162

163163
- We do not use \{m,n\};
164164

165-
- We do not use -E;
166-
167165
- We do not use ? or + (which are \{0,1\} and \{1,\}
168166
respectively in BRE) but that goes without saying as these
169167
are ERE elements not BRE (note that \? and \+ are not even part

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/t3200-branch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
201201

202202
test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' '
203203
msg="Branch: renamed refs/heads/baz to refs/heads/bam" &&
204-
grep " 0\{40\}.*$msg$" .git/logs/HEAD &&
205-
grep "^0\{40\}.*$msg$" .git/logs/HEAD
204+
grep " $ZERO_OID.*$msg$" .git/logs/HEAD &&
205+
grep "^$ZERO_OID.*$msg$" .git/logs/HEAD
206206
'
207207

208208
test_expect_success 'git branch -M should leave orphaned HEAD alone' '

t/t3305-notes-fanout.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ path_has_fanout() {
99
path=$1 &&
1010
fanout=$2 &&
1111
after_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&
12-
echo $path | grep -q "^\([0-9a-f]\{2\}/\)\{$fanout\}[0-9a-f]\{$after_last_slash\}$"
12+
echo $path | grep -q -E "^([0-9a-f]{2}/){$fanout}[0-9a-f]{$after_last_slash}$"
1313
}
1414

1515
touched_one_note_with_fanout() {

t/t3404-rebase-interactive.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,9 +1244,9 @@ test_expect_success 'short commit ID collide' '
12441244
test $colliding_id = "$(git rev-parse HEAD | cut -c 1-4)" &&
12451245
grep "^pick $colliding_id " \
12461246
.git/rebase-merge/git-rebase-todo.tmp &&
1247-
grep "^pick [0-9a-f]\{$hexsz\}" \
1247+
grep -E "^pick [0-9a-f]{$hexsz}" \
12481248
.git/rebase-merge/git-rebase-todo &&
1249-
grep "^pick [0-9a-f]\{$hexsz\}" \
1249+
grep -E "^pick [0-9a-f]{$hexsz}" \
12501250
.git/rebase-merge/git-rebase-todo.backup &&
12511251
git rebase --continue
12521252
) &&
@@ -1261,7 +1261,7 @@ test_expect_success 'respect core.abbrev' '
12611261
set_cat_todo_editor &&
12621262
test_must_fail git rebase -i HEAD~4 >todo-list
12631263
) &&
1264-
test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
1264+
test 4 = $(grep -c -E "pick [0-9a-f]{12,}" todo-list)
12651265
'
12661266

12671267
test_expect_success 'todo count' '

t/t3700-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" '
291291
git reset --hard &&
292292
touch fo\[ou\]bar foobar &&
293293
git add '\''fo\[ou\]bar'\'' &&
294-
git ls-files fo\[ou\]bar | fgrep fo\[ou\]bar &&
294+
git ls-files fo\[ou\]bar | grep -F fo\[ou\]bar &&
295295
! ( git ls-files foobar | grep foobar )
296296
'
297297

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

0 commit comments

Comments
 (0)