@matheusbsbs / matheus-bagliano / commits / d9b31db2c4
Fork 0

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>

Denton Liu committed Dec 4, 2019 at 14:03 UTC d9b31db2c42580af96499e763f4a681803f72826
1 file changed +9 -10
t/t7700-repack.sh
+9 -10
@@ -48,14 +48,13 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
48 git commit -m initial_commit &&
49 # Create two packs
50 # The first pack will contain all of the objects except one
51 - git rev-list --objects --all | grep -v file2 |
52 - git pack-objects pack &&
51 + git rev-list --objects --all >objs &&
52 + grep -v file2 objs | git pack-objects pack &&
53 # The second pack will contain the excluded object
54 - packid=$(git rev-list --objects --all | grep file2 |
55 - git pack-objects pack) &&
54 + packid=$(grep file2 objs | git pack-objects pack) &&
55 >pack-$packid.keep &&
57 - oid=$(git verify-pack -v pack-$packid.idx | head -n 1 |
58 - sed -e "s/^\($OID_REGEX\).*/\1/") &&
56 + git verify-pack -v pack-$packid.idx >packlist &&
57 + oid=$(head -n 1 packlist | sed -e "s/^\($OID_REGEX\).*/\1/") &&
58 mv pack-* .git/objects/pack/ &&
59 git repack -A -d -l &&
60 git prune-packed &&
@@ -134,8 +133,8 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
133 --unpack-unreachable </dev/null pack &&
134 rm -f .git/objects/pack/* &&
135 mv pack-* .git/objects/pack/ &&
137 - test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
138 - grep "^$coid " | sort | uniq | wc -l) &&
136 + git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
137 + ! grep "^$coid " packlist &&
138 echo >.git/objects/info/alternates &&
139 test_must_fail git show $coid
140 '
@@ -151,8 +150,8 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
150 --unpack-unreachable </dev/null pack &&
151 rm -f .git/objects/pack/* &&
152 mv pack-* .git/objects/pack/ &&
154 - test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
155 - grep "^$coid " | sort | uniq | wc -l) &&
153 + git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
154 + ! grep "^$coid " &&
155 echo >.git/objects/info/alternates &&
156 test_must_fail git show $coid
157 '