Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/perf/p5332-multi-pack-reuse.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / perf / p5332-multi-pack-reuse.sh` 81 lines ยท 2063 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='tests pack performance with multi-pack reuse' 4 5 . ./perf-lib.sh 6 . "${TEST_DIRECTORY}/perf/lib-pack.sh" 7 8 packdir=.git/objects/pack 9 10 test_perf_large_repo 11 12 find_pack () { 13 for idx in $packdir/pack-*.idx 14 do 15 if git show-index <$idx | grep -q "$1" 16 then 17 basename $idx 18 fi || return 1 19 done 20 } 21 22 repack_into_n_chunks () { 23 git repack -adk && 24 25 test "$1" -eq 1 && return || 26 27 find $packdir -type f | sort >packs.before && 28 29 # partition the repository into $1 chunks of consecutive commits, and 30 # then create $1 packs with the objects reachable from each chunk 31 # (excluding any objects reachable from the previous chunks) 32 sz="$(($(git rev-list --count --all) / $1))" 33 for rev in $(git rev-list --all | awk "NR % $sz == 0" | tac) 34 do 35 pack="$(echo "$rev" | git pack-objects --revs \ 36 --honor-pack-keep --delta-base-offset $packdir/pack)" && 37 touch $packdir/pack-$pack.keep || return 1 38 done 39 40 # grab any remaining objects not packed by the previous step(s) 41 git pack-objects --revs --all --honor-pack-keep --delta-base-offset \ 42 $packdir/pack && 43 44 find $packdir -type f | sort >packs.after && 45 46 # and install the whole thing 47 for f in $(comm -12 packs.before packs.after) 48 do 49 rm -f "$f" || return 1 50 done 51 rm -fr $packdir/*.keep 52 } 53 54 for nr_packs in 1 10 100 55 do 56 test_expect_success "create $nr_packs-pack scenario" ' 57 repack_into_n_chunks $nr_packs 58 ' 59 60 test_expect_success "setup bitmaps for $nr_packs-pack scenario" ' 61 find $packdir -type f -name "*.idx" | sed -e "s/.*\///" | 62 git multi-pack-index write --stdin-packs --bitmap \ 63 --preferred-pack="$(find_pack $(git rev-parse HEAD))" 64 ' 65 66 for reuse in single multi 67 do 68 test_perf "clone for $nr_packs-pack scenario ($reuse-pack reuse)" " 69 git for-each-ref --format='%(objectname)' refs/heads refs/tags >in && 70 git -c pack.allowPackReuse=$reuse pack-objects \ 71 --revs --delta-base-offset --use-bitmap-index \ 72 --stdout result 73 " 74 75 test_size "clone size for $nr_packs-pack scenario ($reuse-pack reuse)" ' 76 test_file_size result 77 ' 78 done 79 done 80 81 test_done