Skip to content

Commit d9b31db

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3699d69 commit d9b31db

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

t/t7700-repack.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
4848
git commit -m initial_commit &&
4949
# Create two packs
5050
# 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 &&
5353
# 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) &&
5655
>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/") &&
5958
mv pack-* .git/objects/pack/ &&
6059
git repack -A -d -l &&
6160
git prune-packed &&
@@ -134,8 +133,8 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
134133
--unpack-unreachable </dev/null pack &&
135134
rm -f .git/objects/pack/* &&
136135
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 &&
139138
echo >.git/objects/info/alternates &&
140139
test_must_fail git show $coid
141140
'
@@ -151,8 +150,8 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
151150
--unpack-unreachable </dev/null pack &&
152151
rm -f .git/objects/pack/* &&
153152
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 " &&
156155
echo >.git/objects/info/alternates &&
157156
test_must_fail git show $coid
158157
'

0 commit comments

Comments
 (0)