2 test_description
='test git fast-import unpack limit'
4 TEST_PASSES_SANITIZE_LEAK
=true
7 test_expect_success
'create loose objects on import' '
9 cat >input <<-INPUT_END &&
10 commit refs/heads/main
11 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
19 git -c fastimport.unpackLimit=2 fast-import --done <input &&
20 git fsck --no-progress &&
21 test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
22 test $(find .git/objects/pack -type f | wc -l) -eq 0
25 test_expect_success
'bigger packs are preserved' '
27 cat >input <<-INPUT_END &&
28 commit refs/heads/main
29 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
31 incremental should create a pack
33 from refs/heads/main^0
35 commit refs/heads/branch
36 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
44 git -c fastimport.unpackLimit=2 fast-import --done <input &&
45 git fsck --no-progress &&
46 test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
47 test $(find .git/objects/pack -type f | wc -l) -eq 2
50 test_expect_success
'lookups after checkpoint works' '
51 hello_id=$(echo hello | git hash-object --stdin -t blob) &&
52 id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
53 before=$(git rev-parse refs/heads/main^0) &&
61 commit refs/heads/main
67 from refs/heads/main^0
81 while test x"$from" = x"$before"
85 echo >&2 "checkpoint did not update branch" &&
91 from=$(git rev-parse refs/heads/main^0)
94 commit refs/heads/main
97 make sure from "unpacked sha1 reference" works, too
102 ) | git -c fastimport.unpackLimit=100 fast-import --done &&
103 test $(find .git/objects/?? -type f | wc -l) -eq 6 &&
104 test $(find .git/objects/pack -type f | wc -l) -eq 2