2 test_description='test git fast-import unpack limit'
5 test_expect_success 'create loose objects on import' '
7 cat >input <<-INPUT_END &&
9 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
17 git -c fastimport.unpackLimit=2 fast-import --done <input &&
18 git fsck --no-progress &&
19 test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
20 test $(find .git/objects/pack -type f | wc -l) -eq 0
23 test_expect_success 'bigger packs are preserved' '
25 cat >input <<-INPUT_END &&
26 commit refs/heads/main
27 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
29 incremental should create a pack
31 from refs/heads/main^0
33 commit refs/heads/branch
34 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
42 git -c fastimport.unpackLimit=2 fast-import --done <input &&
43 git fsck --no-progress &&
44 test $(find .git/objects/?? -type f | wc -l) -eq 2 &&
45 test $(find .git/objects/pack -type f | wc -l) -eq 2
48 test_expect_success 'lookups after checkpoint works' '
49 hello_id=$(echo hello | git hash-object --stdin -t blob) &&
50 id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
51 before=$(git rev-parse refs/heads/main^0) &&
59 commit refs/heads/main
65 from refs/heads/main^0
79 while test x"$from" = x"$before"
83 echo >&2 "checkpoint did not update branch" &&
89 from=$(git rev-parse refs/heads/main^0)
92 commit refs/heads/main
95 make sure from "unpacked sha1 reference" works, too
100 ) | git -c fastimport.unpackLimit=100 fast-import --done &&
101 test $(find .git/objects/?? -type f | wc -l) -eq 6 &&
102 test $(find .git/objects/pack -type f | wc -l) -eq 2