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>
This commit is contained in:
Matthew DeVore 2018-10-05 14:54:06 -07:00 committed by Junio C Hamano
parent 61de0ff695
commit b00b6ace5c

View File

@ -174,7 +174,8 @@ test_expect_success 'test create-ignore' "
cmp ./deeply/.gitignore create-ignore.expect && cmp ./deeply/.gitignore create-ignore.expect &&
cmp ./deeply/nested/.gitignore create-ignore.expect && cmp ./deeply/nested/.gitignore create-ignore.expect &&
cmp ./deeply/nested/directory/.gitignore create-ignore.expect && cmp ./deeply/nested/directory/.gitignore create-ignore.expect &&
git ls-files -s | grep gitignore | cmp - create-ignore-index.expect git ls-files -s >ls_files_result &&
grep gitignore ls_files_result | cmp - create-ignore-index.expect
" "
cat >prop.expect <<\EOF cat >prop.expect <<\EOF
@ -189,17 +190,21 @@ EOF
# This test can be improved: since all the svn:ignore contain the same # This test can be improved: since all the svn:ignore contain the same
# pattern, it can pass even though the propget did not execute on the # pattern, it can pass even though the propget did not execute on the
# right directory. # right directory.
test_expect_success 'test propget' " test_expect_success 'test propget' '
git svn propget svn:ignore . | cmp - prop.expect && test_propget () {
git svn propget $1 $2 >actual &&
cmp $3 actual
} &&
test_propget svn:ignore . prop.expect &&
cd deeply && cd deeply &&
git svn propget svn:ignore . | cmp - ../prop.expect && test_propget svn:ignore . ../prop.expect &&
git svn propget svn:entry:committed-rev nested/directory/.keep \ test_propget svn:entry:committed-rev nested/directory/.keep \
| cmp - ../prop2.expect && ../prop2.expect &&
git svn propget svn:ignore .. | cmp - ../prop.expect && test_propget svn:ignore .. ../prop.expect &&
git svn propget svn:ignore nested/ | cmp - ../prop.expect && test_propget svn:ignore nested/ ../prop.expect &&
git svn propget svn:ignore ./nested | cmp - ../prop.expect && test_propget svn:ignore ./nested ../prop.expect &&
git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect test_propget svn:ignore .././deeply/nested ../prop.expect
" '
cat >prop.expect <<\EOF cat >prop.expect <<\EOF
Properties on '.': Properties on '.':
@ -218,8 +223,11 @@ Properties on 'nested/directory/.keep':
EOF EOF
test_expect_success 'test proplist' " test_expect_success 'test proplist' "
git svn proplist . | cmp - prop.expect && git svn proplist . >actual &&
git svn proplist nested/directory/.keep | cmp - prop2.expect cmp prop.expect actual &&
git svn proplist nested/directory/.keep >actual &&
cmp prop2.expect actual
" "
test_done test_done