Files
git/t/t5315-pack-objects-compression.sh
Bilal El Khatabi 1d6fd6d36e t5315: use test_path_is_file for loose-object check
Use test_path_is_file instead of test -f when checking that the
loose object was written to the expected path.

This uses Git's path-checking helper, which provides more specific
failure output than a raw test -f check.

Signed-off-by: Bilal El Khatabi <elkhatabibilal@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-19 11:58:18 -07:00

39 lines
1007 B
Bash
Executable File

#!/bin/sh
test_description='pack-object compression configuration'
. ./test-lib.sh
test_expect_success setup '
printf "%2000000s" X |
git hash-object -w --stdin >object-name &&
# make sure it resulted in a loose object
ob=$(sed -e "s/\(..\).*/\1/" object-name) &&
ject=$(sed -e "s/..\(.*\)/\1/" object-name) &&
test_path_is_file .git/objects/$ob/$ject
'
while read expect config
do
test_expect_success "pack-objects with $config" '
test_when_finished "rm -f pack-*.*" &&
git $config pack-objects pack <object-name &&
sz=$(test_file_size pack-*.pack) &&
case "$expect" in
small) test "$sz" -le 100000 ;;
large) test "$sz" -ge 100000 ;;
esac
'
done <<\EOF
large -c core.compression=0
small -c core.compression=9
large -c core.compression=0 -c pack.compression=0
large -c core.compression=9 -c pack.compression=0
small -c core.compression=0 -c pack.compression=9
small -c core.compression=9 -c pack.compression=9
large -c pack.compression=0
small -c pack.compression=9
EOF
test_done