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>
This commit is contained in:
Pratik Karki
2018-03-27 23:16:37 +05:45
committed by Junio C Hamano
parent d32eb83c1d
commit a4d4e32a70
15 changed files with 179 additions and 159 deletions

View File

@ -68,7 +68,8 @@ test_debug 'gitk --all & sleep 1'
test_expect_success 'verify pre-merge ancestry' "
test x\$(git rev-parse --verify refs/heads/svn^2) = \
x\$(git rev-parse --verify refs/heads/merge) &&
git cat-file commit refs/heads/svn^ | grep '^friend$'
git cat-file commit refs/heads/svn^ >actual &&
grep '^friend$' actual
"
test_expect_success 'git svn dcommit merges' "
@ -82,12 +83,13 @@ test_expect_success 'verify post-merge ancestry' "
x\$(git rev-parse --verify refs/remotes/origin/trunk) &&
test x\$(git rev-parse --verify refs/heads/svn^2) = \
x\$(git rev-parse --verify refs/heads/merge) &&
git cat-file commit refs/heads/svn^ | grep '^friend$'
git cat-file commit refs/heads/svn^ >actual &&
grep '^friend$' actual
"
test_expect_success 'verify merge commit message' "
git rev-list --pretty=raw -1 refs/heads/svn | \
grep \" Merge branch 'merge' into svn\"
git rev-list --pretty=raw -1 refs/heads/svn >actual &&
grep \" Merge branch 'merge' into svn\" actual
"
test_done