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:

committed by
Junio C Hamano

parent
d32eb83c1d
commit
a4d4e32a70
@ -47,8 +47,8 @@ test_expect_success 'test refspec globbing' '
|
||||
git config --add svn-remote.svn.tags\
|
||||
"tags/*/src/a:refs/remotes/tags/*" &&
|
||||
git svn multi-fetch &&
|
||||
git log --pretty=oneline refs/remotes/tags/end | \
|
||||
sed -e "s/^.\{41\}//" > output.end &&
|
||||
git log --pretty=oneline refs/remotes/tags/end >actual &&
|
||||
sed -e "s/^.\{41\}//" actual >output.end &&
|
||||
test_cmp expect.end output.end &&
|
||||
test "$(git rev-parse refs/remotes/tags/end~1)" = \
|
||||
"$(git rev-parse refs/remotes/branches/v1/start)" &&
|
||||
@ -75,14 +75,16 @@ test_expect_success 'test left-hand-side only globbing' '
|
||||
svn_cmd commit -m "try to try"
|
||||
) &&
|
||||
git svn fetch two &&
|
||||
test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
|
||||
test $(git rev-list refs/remotes/two/branches/v1/start | wc -l) -eq 3 &&
|
||||
git rev-list refs/remotes/two/tags/end >actual &&
|
||||
test_line_count = 6 actual &&
|
||||
git rev-list refs/remotes/two/branches/v1/start >actual &&
|
||||
test_line_count = 3 actual &&
|
||||
test $(git rev-parse refs/remotes/two/branches/v1/start~2) = \
|
||||
$(git rev-parse refs/remotes/two/trunk) &&
|
||||
test $(git rev-parse refs/remotes/two/tags/end~3) = \
|
||||
$(git rev-parse refs/remotes/two/branches/v1/start) &&
|
||||
git log --pretty=oneline refs/remotes/two/tags/end | \
|
||||
sed -e "s/^.\{41\}//" > output.two &&
|
||||
git log --pretty=oneline refs/remotes/two/tags/end >actual &&
|
||||
sed -e "s/^.\{41\}//" actual >output.two &&
|
||||
test_cmp expect.two output.two
|
||||
'
|
||||
cat > expect.four <<EOF
|
||||
@ -124,14 +126,16 @@ test_expect_success 'test another branch' '
|
||||
git config --add svn-remote.four.tags \
|
||||
"tags/*:refs/remotes/four/tags/*" &&
|
||||
git svn fetch four &&
|
||||
test $(git rev-list refs/remotes/four/tags/next | wc -l) -eq 5 &&
|
||||
test $(git rev-list refs/remotes/four/branches/v2/start | wc -l) -eq 3 &&
|
||||
git rev-list refs/remotes/four/tags/next >actual &&
|
||||
test_line_count = 5 actual &&
|
||||
git rev-list refs/remotes/four/branches/v2/start >actual &&
|
||||
test_line_count = 3 actual &&
|
||||
test $(git rev-parse refs/remotes/four/branches/v2/start~2) = \
|
||||
$(git rev-parse refs/remotes/four/trunk) &&
|
||||
test $(git rev-parse refs/remotes/four/tags/next~2) = \
|
||||
$(git rev-parse refs/remotes/four/branches/v2/start) &&
|
||||
git log --pretty=oneline refs/remotes/four/tags/next | \
|
||||
sed -e "s/^.\{41\}//" > output.four &&
|
||||
git log --pretty=oneline refs/remotes/four/tags/next >actual &&
|
||||
sed -e "s/^.\{41\}//" actual >output.four &&
|
||||
test_cmp expect.four output.four
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user