t9109: don't swallow Git errors upstream of pipes

'git ... | foo' will mask any errors or crashes in git, so split up such pipes in this file. One testcase uses several separate pipe sequences in a row which are awkward to split up. Wrap the split-up pipe in a function so the awkwardness is not repeated. Also change that testcase's surrounding quotes from double to single to avoid premature string interpolation. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthew DeVore committed Oct 5, 2018 at 14:54 UTC b00b6ace5c92ef4c2893f7b7cc597a0297812a52
1 file changed +21 -13
t/t9101-git-svn-props.sh
+21 -13
@@ -174,7 +174,8 @@ test_expect_success 'test create-ignore' "
174 cmp ./deeply/.gitignore create-ignore.expect &&
175 cmp ./deeply/nested/.gitignore create-ignore.expect &&
176 cmp ./deeply/nested/directory/.gitignore create-ignore.expect &&
177 - git ls-files -s | grep gitignore | cmp - create-ignore-index.expect
177 + git ls-files -s >ls_files_result &&
178 + grep gitignore ls_files_result | cmp - create-ignore-index.expect
179 "
180
181 cat >prop.expect <<\EOF
@@ -189,17 +190,21 @@ EOF
190 # This test can be improved: since all the svn:ignore contain the same
191 # pattern, it can pass even though the propget did not execute on the
192 # right directory.
192 -test_expect_success 'test propget' "
193 - git svn propget svn:ignore . | cmp - prop.expect &&
193 +test_expect_success 'test propget' '
194 + test_propget () {
195 + git svn propget $1 $2 >actual &&
196 + cmp $3 actual
197 + } &&
198 + test_propget svn:ignore . prop.expect &&
199 cd deeply &&
195 - git svn propget svn:ignore . | cmp - ../prop.expect &&
196 - git svn propget svn:entry:committed-rev nested/directory/.keep \
197 - | cmp - ../prop2.expect &&
198 - git svn propget svn:ignore .. | cmp - ../prop.expect &&
199 - git svn propget svn:ignore nested/ | cmp - ../prop.expect &&
200 - git svn propget svn:ignore ./nested | cmp - ../prop.expect &&
201 - git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
202 - "
200 + test_propget svn:ignore . ../prop.expect &&
201 + test_propget svn:entry:committed-rev nested/directory/.keep \
202 + ../prop2.expect &&
203 + test_propget svn:ignore .. ../prop.expect &&
204 + test_propget svn:ignore nested/ ../prop.expect &&
205 + test_propget svn:ignore ./nested ../prop.expect &&
206 + test_propget svn:ignore .././deeply/nested ../prop.expect
207 + '
208
209 cat >prop.expect <<\EOF
210 Properties on '.':
@@ -218,8 +223,11 @@ Properties on 'nested/directory/.keep':
223 EOF
224
225 test_expect_success 'test proplist' "
221 - git svn proplist . | cmp - prop.expect &&
222 - git svn proplist nested/directory/.keep | cmp - prop2.expect
226 + git svn proplist . >actual &&
227 + cmp prop.expect actual &&
228 +
229 + git svn proplist nested/directory/.keep >actual &&
230 + cmp prop2.expect actual
231 "
232
233 test_done