t7700: stop losing return codes of git commands

In a pipe, only the return code of the last command is used. Thus, all
other commands will have their return codes masked. Rewrite pipes so
that there are no git commands upstream so that we will know if a
command fails.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Denton Liu 2019-12-04 14:03:30 -08:00 committed by Junio C Hamano
parent 3699d69df0
commit d9b31db2c4

View file

@ -48,14 +48,13 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
git commit -m initial_commit &&
# Create two packs
# The first pack will contain all of the objects except one
git rev-list --objects --all | grep -v file2 |
git pack-objects pack &&
git rev-list --objects --all >objs &&
grep -v file2 objs | git pack-objects pack &&
# The second pack will contain the excluded object
packid=$(git rev-list --objects --all | grep file2 |
git pack-objects pack) &&
packid=$(grep file2 objs | git pack-objects pack) &&
>pack-$packid.keep &&
oid=$(git verify-pack -v pack-$packid.idx | head -n 1 |
sed -e "s/^\($OID_REGEX\).*/\1/") &&
git verify-pack -v pack-$packid.idx >packlist &&
oid=$(head -n 1 packlist | sed -e "s/^\($OID_REGEX\).*/\1/") &&
mv pack-* .git/objects/pack/ &&
git repack -A -d -l &&
git prune-packed &&
@ -134,8 +133,8 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
--unpack-unreachable </dev/null pack &&
rm -f .git/objects/pack/* &&
mv pack-* .git/objects/pack/ &&
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
grep "^$coid " | sort | uniq | wc -l) &&
git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
! grep "^$coid " packlist &&
echo >.git/objects/info/alternates &&
test_must_fail git show $coid
'
@ -151,8 +150,8 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
--unpack-unreachable </dev/null pack &&
rm -f .git/objects/pack/* &&
mv pack-* .git/objects/pack/ &&
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
grep "^$coid " | sort | uniq | wc -l) &&
git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
! grep "^$coid " &&
echo >.git/objects/info/alternates &&
test_must_fail git show $coid
'