summaryrefslogtreecommitdiff
path: root/t/t9130-git-svn-authors-file.sh
diff options
context:
space:
mode:
authorPratik Karki <predatoramigo@gmail.com>2018-03-27 17:31:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-28 16:30:14 (GMT)
commita4d4e32a700df92ca576ce89110c075b8ce6da75 (patch)
tree4f991815ba071fc8849314f248018d1054a7ef99 /t/t9130-git-svn-authors-file.sh
parentd32eb83c1db7d0a8bb54fe743c6d1dd674d372c5 (diff)
downloadgit-a4d4e32a700df92ca576ce89110c075b8ce6da75.zip
git-a4d4e32a700df92ca576ce89110c075b8ce6da75.tar.gz
git-a4d4e32a700df92ca576ce89110c075b8ce6da75.tar.bz2
test: avoid pipes in git related commands for test
Avoid using pipes downstream of Git commands since the exit codes of commands upstream of pipes get swallowed, thus potentially hiding failure of those commands. Instead, capture Git command output to a file and apply the downstream command(s) to that file. Signed-off-by: Pratik Karki <predatoramigo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9130-git-svn-authors-file.sh')
-rwxr-xr-xt/t9130-git-svn-authors-file.sh28
1 files changed, 16 insertions, 12 deletions
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index 4126481..7752a1f 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -26,11 +26,12 @@ test_expect_success 'start import with incomplete authors file' '
test_expect_success 'imported 2 revisions successfully' '
(
cd x
- test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 2 &&
- git rev-list -1 --pretty=raw refs/remotes/git-svn | \
- grep "^author BBBBBBB BBBBBBB <bb@example\.com> " &&
- git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
- grep "^author AAAAAAA AAAAAAA <aa@example\.com> "
+ git rev-list refs/remotes/git-svn >actual &&
+ test_line_count = 2 actual &&
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+ grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
+ grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
)
'
@@ -43,11 +44,12 @@ test_expect_success 'continues to import once authors have been added' '
(
cd x
git svn fetch --authors-file=../svn-authors &&
- test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 4 &&
- git rev-list -1 --pretty=raw refs/remotes/git-svn | \
- grep "^author DDDDDDD DDDDDDD <dd@example\.com> " &&
- git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
- grep "^author CCCCCCC CCCCCCC <cc@example\.com> "
+ git rev-list refs/remotes/git-svn >actual &&
+ test_line_count = 4 actual &&
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+ grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
+ grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
)
'
@@ -102,8 +104,10 @@ test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
git svn clone "$svnrepo" gitconfig.clone &&
cd gitconfig.clone &&
- nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
- nr_rev=$(git rev-list HEAD | wc -l) &&
+ git log >actual &&
+ nr_ex=$(grep "^Author:.*example.com" actual | wc -l) &&
+ git rev-list HEAD >actual &&
+ nr_rev=$(wc -l <actual) &&
test $nr_rev -eq $nr_ex
)
'