mirror of
https://github.com/git/git
synced 2024-08-28 20:20:07 +00:00
![Eric Sunshine](/assets/img/avatar_default.png)
The use of `|| return` (or `|| exit`) to signal failure within a loop isn't effective when the loop is upstream of a pipe since the pipe swallows all upstream exit codes and returns only the exit code of the final command in the pipeline. To work around this limitation, tests may adopt an alternative strategy of signaling failure by emitting text which would never be emitted in the non-failing case. For instance: while condition do command1 && command2 || echo "impossible text" done | sort >actual && Such usage indicates deliberate thought about failure cases by the test author, thus flagging them as missing `|| return` (or `|| exit`) is not helpful. Therefore, take this case into consideration when checking for explicit loop termination. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 lines
270 B
Plaintext
11 lines
270 B
Plaintext
(
|
|
git rev-list --objects --no-object-names base..loose |
|
|
while read oid
|
|
do
|
|
path="$objdir/$(test_oid_to_path "$oid")" &&
|
|
printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" ||
|
|
echo "object list generation failed for $oid"
|
|
done |
|
|
sort -k1
|
|
) >expect &&
|