Skip to content

Commit 7f18fad

Browse files
committed
Merge branch 'jk/grep-binary-workaround-in-test' into maint
Recent versions of GNU grep are pickier when their input contains arbitrary binary data, which some of our tests uses. Rewrite the tests to sidestep the problem. * jk/grep-binary-workaround-in-test: t9200: avoid grep on non-ASCII data t8005: avoid grep on non-ASCII data
2 parents d4e7b9b + 3b1442d commit 7f18fad

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

t/t8005-blame-i18n.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ author $SJIS_NAME
3333
summary $SJIS_MSG
3434
EOF
3535

36+
filter_author_summary () {
37+
sed -n -e '/^author /p' -e '/^summary /p' "$@"
38+
}
39+
3640
test_expect_success !MINGW \
3741
'blame respects i18n.commitencoding' '
38-
git blame --incremental file | \
39-
egrep "^(author|summary) " > actual &&
40-
test_cmp actual expected
42+
git blame --incremental file >output &&
43+
filter_author_summary output >actual &&
44+
test_cmp expected actual
4145
'
4246

4347
cat >expected <<EOF
@@ -52,9 +56,9 @@ EOF
5256
test_expect_success !MINGW \
5357
'blame respects i18n.logoutputencoding' '
5458
git config i18n.logoutputencoding eucJP &&
55-
git blame --incremental file | \
56-
egrep "^(author|summary) " > actual &&
57-
test_cmp actual expected
59+
git blame --incremental file >output &&
60+
filter_author_summary output >actual &&
61+
test_cmp expected actual
5862
'
5963

6064
cat >expected <<EOF
@@ -68,9 +72,9 @@ EOF
6872

6973
test_expect_success !MINGW \
7074
'blame respects --encoding=UTF-8' '
71-
git blame --incremental --encoding=UTF-8 file | \
72-
egrep "^(author|summary) " > actual &&
73-
test_cmp actual expected
75+
git blame --incremental --encoding=UTF-8 file >output &&
76+
filter_author_summary output >actual &&
77+
test_cmp expected actual
7478
'
7579

7680
cat >expected <<EOF
@@ -84,9 +88,9 @@ EOF
8488

8589
test_expect_success !MINGW \
8690
'blame respects --encoding=none' '
87-
git blame --incremental --encoding=none file | \
88-
egrep "^(author|summary) " > actual &&
89-
test_cmp actual expected
91+
git blame --incremental --encoding=none file >output &&
92+
filter_author_summary output >actual &&
93+
test_cmp expected actual
9094
'
9195

9296
test_done

t/t9200-git-cvsexportcommit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exit 1
3535

3636
check_entries () {
3737
# $1 == directory, $2 == expected
38-
grep '^/' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
38+
sed -ne '/^\//p' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
3939
if test -z "$2"
4040
then
4141
>expected

0 commit comments

Comments
 (0)