summaryrefslogtreecommitdiff
path: root/t/t1050-large.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1050-large.sh')
-rwxr-xr-xt/t1050-large.sh59
1 files changed, 29 insertions, 30 deletions
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 184b479..c71932b 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -5,11 +5,11 @@ test_description='adding and checking out large blobs'
. ./test-lib.sh
-# This should be moved to test-lib.sh together with the
-# copy in t0021 after both topics have graduated to 'master'.
-file_size () {
- test-tool path-utils file-size "$1"
-}
+test_expect_success 'core.bigFileThreshold must be non-negative' '
+ test_must_fail git -c core.bigFileThreshold=-1 rev-parse >out 2>err &&
+ grep "bad numeric config value" err &&
+ test_must_be_empty out
+'
test_expect_success setup '
# clone does not allow us to pass core.bigfilethreshold to
@@ -23,13 +23,21 @@ test_expect_success setup '
export GIT_ALLOC_LIMIT
'
+test_expect_success 'enter "large" codepath, with small core.bigFileThreshold' '
+ test_when_finished "rm -rf repo" &&
+
+ git init --bare repo &&
+ echo large | git -C repo hash-object -w --stdin &&
+ git -C repo -c core.bigfilethreshold=4 fsck
+'
+
# add a large file with different settings
while read expect config
do
test_expect_success "add with $config" '
test_when_finished "rm -f .git/objects/pack/pack-*.* .git/index" &&
git $config add large1 &&
- sz=$(file_size .git/objects/pack/pack-*.pack) &&
+ sz=$(test_file_size .git/objects/pack/pack-*.pack) &&
case "$expect" in
small) test "$sz" -le 100000 ;;
large) test "$sz" -ge 100000 ;;
@@ -49,42 +57,32 @@ EOF
test_expect_success 'add a large file or two' '
git add large1 huge large2 &&
# make sure we got a single packfile and no loose objects
- bad= count=0 idx= &&
+ count=0 idx= &&
for p in .git/objects/pack/pack-*.pack
do
- count=$(( $count + 1 ))
- if test_path_is_file "$p" &&
- idx=${p%.pack}.idx && test_path_is_file "$idx"
- then
- continue
- fi
- bad=t
+ count=$(( $count + 1 )) &&
+ test_path_is_file "$p" &&
+ idx=${p%.pack}.idx &&
+ test_path_is_file "$idx" || return 1
done &&
- test -z "$bad" &&
test $count = 1 &&
cnt=$(git show-index <"$idx" | wc -l) &&
test $cnt = 2 &&
- for l in .git/objects/??/??????????????????????????????????????
+ for l in .git/objects/$OIDPATH_REGEX
do
- test_path_is_file "$l" || continue
- bad=t
+ test_path_is_missing "$l" || return 1
done &&
- test -z "$bad" &&
# attempt to add another copy of the same
git add large3 &&
bad= count=0 &&
for p in .git/objects/pack/pack-*.pack
do
- count=$(( $count + 1 ))
- if test_path_is_file "$p" &&
- idx=${p%.pack}.idx && test_path_is_file "$idx"
- then
- continue
- fi
- bad=t
+ count=$(( $count + 1 )) &&
+ test_path_is_file "$p" &&
+ idx=${p%.pack}.idx &&
+ test_path_is_file "$idx" || return 1
done &&
- test -z "$bad" &&
test $count = 1
'
@@ -113,7 +111,7 @@ test_expect_success 'packsize limit' '
count=0 &&
for pi in .git/objects/pack/pack-*.idx
do
- test_path_is_file "$pi" && count=$(( $count + 1 ))
+ test_path_is_file "$pi" && count=$(( $count + 1 )) || return 1
done &&
test $count = 2 &&
@@ -126,7 +124,7 @@ test_expect_success 'packsize limit' '
for pi in .git/objects/pack/pack-*.idx
do
- git show-index <"$pi"
+ git show-index <"$pi" || return 1
done |
sed -e "s/^[0-9]* \([0-9a-f]*\) .*/\1/" |
sort >actual &&
@@ -177,7 +175,8 @@ test_expect_success 'git-show a large file' '
test_expect_success 'index-pack' '
git clone file://"$(pwd)"/.git foo &&
- GIT_DIR=non-existent git index-pack --strict --verify foo/.git/objects/pack/*.pack
+ GIT_DIR=non-existent git index-pack --object-format=$(test_oid algo) \
+ --strict --verify foo/.git/objects/pack/*.pack
'
test_expect_success 'repack' '