File tree Expand file tree Collapse file tree 8 files changed +72
-43
lines changed Expand file tree Collapse file tree 8 files changed +72
-43
lines changed Original file line number Diff line number Diff line change @@ -134,11 +134,15 @@ test_expect_success 'favour same basenames over different ones' '
134
134
git rm path1 &&
135
135
mkdir subdir &&
136
136
git mv another-path subdir/path1 &&
137
- git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
137
+ git status >out &&
138
+ test_i18ngrep "renamed: .*path1 -> subdir/path1" out
139
+ '
138
140
139
141
test_expect_success ' favour same basenames even with minor differences' '
140
142
git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
141
- git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
143
+ git status >out &&
144
+ test_i18ngrep "renamed: .*path1 -> subdir/path1" out
145
+ '
142
146
143
147
test_expect_success ' two files with same basename and same content' '
144
148
git reset --hard &&
@@ -148,7 +152,8 @@ test_expect_success 'two files with same basename and same content' '
148
152
git add dir &&
149
153
git commit -m 2 &&
150
154
git mv dir other-dir &&
151
- git status | test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file"
155
+ git status >out &&
156
+ test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
152
157
'
153
158
154
159
test_expect_success ' setup for many rename source candidates' '
Original file line number Diff line number Diff line change @@ -222,12 +222,9 @@ test_expect_success 'fetch uses remote ref names to describe new refs' '
222
222
(
223
223
cd descriptive &&
224
224
git fetch o 2>actual &&
225
- grep " -> refs/crazyheads/descriptive-branch$" actual |
226
- test_i18ngrep "new branch" &&
227
- grep " -> descriptive-tag$" actual |
228
- test_i18ngrep "new tag" &&
229
- grep " -> crazy$" actual |
230
- test_i18ngrep "new ref"
225
+ test_i18ngrep "new branch.* -> refs/crazyheads/descriptive-branch$" actual &&
226
+ test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
227
+ test_i18ngrep "new ref.* -> crazy$" actual
231
228
) &&
232
229
git checkout master
233
230
'
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ verify_stderr () {
22
22
cat > expected &&
23
23
# We're not interested in the error
24
24
# "fatal: The remote end hung up unexpectedly":
25
- test_i18ngrep -E ' ^(fatal|warning):' < error | grep -v ' hung up' > actual | sort &&
25
+ test_i18ngrep -E ' ^(fatal|warning):' error | grep -v ' hung up' > actual | sort &&
26
26
test_i18ncmp expected actual
27
27
}
28
28
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ test_expect_success TTY 'push --no-progress silences progress but not status' '
234
234
test_commit no-progress &&
235
235
test_terminal git push --no-progress >output 2>&1 &&
236
236
test_i18ngrep "^To http" output &&
237
- test_i18ngrep ! "^Writing objects"
237
+ test_i18ngrep ! "^Writing objects" output
238
238
'
239
239
240
240
test_expect_success ' push --progress shows progress to non-tty' '
Original file line number Diff line number Diff line change @@ -20,10 +20,7 @@ test_expect_success 'curl redirects respect whitelist' '
20
20
test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
21
21
GIT_SMART_HTTP=0 \
22
22
git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
23
- {
24
- test_i18ngrep "ftp.*disabled" stderr ||
25
- test_i18ngrep "your curl version is too old"
26
- }
23
+ test_i18ngrep -E "(ftp.*disabled|your curl version is too old)" stderr
27
24
'
28
25
29
26
test_expect_success ' curl limits redirects' '
Original file line number Diff line number Diff line change @@ -242,10 +242,12 @@ test_expect_success 'merge of identical changes in a renamed file' '
242
242
rm -f A M N &&
243
243
git reset --hard &&
244
244
git checkout change+rename &&
245
- GIT_MERGE_VERBOSITY=3 git merge change | test_i18ngrep "^Skipped B" &&
245
+ GIT_MERGE_VERBOSITY=3 git merge change >out &&
246
+ test_i18ngrep "^Skipped B" out &&
246
247
git reset --hard HEAD^ &&
247
248
git checkout change &&
248
- GIT_MERGE_VERBOSITY=3 git merge change+rename | test_i18ngrep "^Skipped B"
249
+ GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&
250
+ test_i18ngrep "^Skipped B" out
249
251
'
250
252
251
253
test_expect_success ' setup for rename + d/f conflicts' '
Original file line number Diff line number Diff line change @@ -705,6 +705,60 @@ test_cmp_bin() {
705
705
cmp " $@ "
706
706
}
707
707
708
+ # Use this instead of test_cmp to compare files that contain expected and
709
+ # actual output from git commands that can be translated. When running
710
+ # under GETTEXT_POISON this pretends that the command produced expected
711
+ # results.
712
+ test_i18ncmp () {
713
+ test -n " $GETTEXT_POISON " || test_cmp " $@ "
714
+ }
715
+
716
+ # Use this instead of "grep expected-string actual" to see if the
717
+ # output from a git command that can be translated either contains an
718
+ # expected string, or does not contain an unwanted one. When running
719
+ # under GETTEXT_POISON this pretends that the command produced expected
720
+ # results.
721
+ test_i18ngrep () {
722
+ eval " last_arg=\$ {$# }"
723
+
724
+ test -f " $last_arg " ||
725
+ error " bug in the test script: test_i18ngrep requires a file" \
726
+ " to read as the last parameter"
727
+
728
+ if test $# -lt 2 ||
729
+ { test " x!" = " x$1 " && test $# -lt 3 ; }
730
+ then
731
+ error " bug in the test script: too few parameters to test_i18ngrep"
732
+ fi
733
+
734
+ if test -n " $GETTEXT_POISON "
735
+ then
736
+ # pretend success
737
+ return 0
738
+ fi
739
+
740
+ if test " x!" = " x$1 "
741
+ then
742
+ shift
743
+ ! grep " $@ " && return 0
744
+
745
+ echo >&2 " error: '! grep $@ ' did find a match in:"
746
+ else
747
+ grep " $@ " && return 0
748
+
749
+ echo >&2 " error: 'grep $@ ' didn't find a match in:"
750
+ fi
751
+
752
+ if test -s " $last_arg "
753
+ then
754
+ cat >&2 " $last_arg "
755
+ else
756
+ echo >&2 " <File '$last_arg ' is empty>"
757
+ fi
758
+
759
+ return 1
760
+ }
761
+
708
762
# Call any command "$@" but be more verbose about its
709
763
# failure. This is handy for commands like "test" which do
710
764
# not output anything when they fail.
Original file line number Diff line number Diff line change @@ -1062,32 +1062,6 @@ else
1062
1062
test_set_prereq C_LOCALE_OUTPUT
1063
1063
fi
1064
1064
1065
- # Use this instead of test_cmp to compare files that contain expected and
1066
- # actual output from git commands that can be translated. When running
1067
- # under GETTEXT_POISON this pretends that the command produced expected
1068
- # results.
1069
- test_i18ncmp () {
1070
- test -n " $GETTEXT_POISON " || test_cmp " $@ "
1071
- }
1072
-
1073
- # Use this instead of "grep expected-string actual" to see if the
1074
- # output from a git command that can be translated either contains an
1075
- # expected string, or does not contain an unwanted one. When running
1076
- # under GETTEXT_POISON this pretends that the command produced expected
1077
- # results.
1078
- test_i18ngrep () {
1079
- if test -n " $GETTEXT_POISON "
1080
- then
1081
- : # pretend success
1082
- elif test " x!" = " x$1 "
1083
- then
1084
- shift
1085
- ! grep " $@ "
1086
- else
1087
- grep " $@ "
1088
- fi
1089
- }
1090
-
1091
1065
test_lazy_prereq PIPE '
1092
1066
# test whether the filesystem supports FIFOs
1093
1067
test_have_prereq !MINGW,!CYGWIN &&
You can’t perform that action at this time.
0 commit comments