mirror of
https://github.com/git/git.git
synced 2026-04-04 14:00:10 +02:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
6a6636270f
commit
d9545c7f46
@@ -52,6 +52,7 @@ echo "$@"'
|
||||
###
|
||||
|
||||
test_expect_success 'empty stream succeeds' '
|
||||
git config fastimport.unpackLimit 0 &&
|
||||
git fast-import </dev/null
|
||||
'
|
||||
|
||||
@@ -2675,6 +2676,7 @@ test_expect_success 'R: blob bigger than threshold' '
|
||||
echo >>input &&
|
||||
|
||||
test_create_repo R &&
|
||||
git --git-dir=R/.git config fastimport.unpackLimit 0 &&
|
||||
git --git-dir=R/.git fast-import --big-file-threshold=1 <input
|
||||
'
|
||||
|
||||
|
||||
48
t/t9302-fast-import-unpack-limit.sh
Executable file
48
t/t9302-fast-import-unpack-limit.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user