git/t/t9302-fast-import-unpack-limit.sh
Eric Wong d9545c7f46 fast-import: implement unpack limit
With many incremental imports, small packs become highly
inefficient due to the need to readdir scan and load many
indices to locate even a single object.  Frequent repacking and
consolidation may be prohibitively expensive in terms of disk
I/O, especially in large repositories where the initial packs
were aggressively optimized and marked with .keep files.

In those cases, users may be better served with loose objects
and relying on "git gc --auto".

This changes the default behavior of fast-import for small
imports found in test cases, so adjustments to t9300 were
necessary.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-11 14:56:00 -07:00

49 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
test_description='test git fast-import unpack limit'
. ./test-lib.sh
test_expect_success 'create loose objects on import' '
test_tick &&
cat >input <<-INPUT_END &&
commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
initial
COMMIT
done
INPUT_END
git -c fastimport.unpackLimit=2 fast-import --done <input &&
git fsck --no-progress &&
test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
test $(find .git/objects/pack -type f | wc -l) -eq 0
'
test_expect_success 'bigger packs are preserved' '
test_tick &&
cat >input <<-INPUT_END &&
commit refs/heads/master
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
incremental should create a pack
COMMIT
from refs/heads/master^0
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
branch
COMMIT
done
INPUT_END
git -c fastimport.unpackLimit=2 fast-import --done <input &&
git fsck --no-progress &&
test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
test $(find .git/objects/pack -type f | wc -l) -eq 2
'
test_done