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/t5332-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 / t5332-multi-pack-reuse.sh` 291 lines ยท 7304 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='pack-objects multi-pack reuse' 4 5 . ./test-lib.sh 6 . "$TEST_DIRECTORY"/lib-bitmap.sh 7 8 GIT_TEST_MULTI_PACK_INDEX=0 9 GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0 10 11 # The --path-walk option does not consider the preferred pack 12 # at all for reusing deltas, so this variable changes the 13 # behavior of this test, if enabled. 14 GIT_TEST_PACK_PATH_WALK=0 15 export GIT_TEST_PACK_PATH_WALK 16 17 objdir=.git/objects 18 packdir=$objdir/pack 19 20 test_pack_reused () { 21 test_trace2_data pack-objects pack-reused "$1" 22 } 23 24 test_packs_reused () { 25 test_trace2_data pack-objects packs-reused "$1" 26 } 27 28 29 # pack_position objects && 32 grep "$1" objects | cut -d" " -f1 33 } 34 35 # test_pack_objects_reused_all 36 test_pack_objects_reused_all () { 37 : >trace2.txt && 38 GIT_TRACE2_EVENT="$PWD/trace2.txt" \ 39 git pack-objects --stdout --revs --all --delta-base-offset \ 40 >got.pack && 41 42 test_pack_reused "$1" 49 test_pack_objects_reused () { 50 : >trace2.txt && 51 GIT_TRACE2_EVENT="$PWD/trace2.txt" \ 52 git pack-objects --stdout --revs >got.pack && 53 54 test_pack_reused "$1" in <<-EOF && 103 $(git rev-parse C) 104 ^$(git rev-parse A) 105 EOF 106 107 test_pack_objects_reused 6 2 in <<-EOF && 140 $(git rev-parse E) 141 ^$(git rev-parse D) 142 EOF 143 144 test_pack_objects_reused 3 1 in <<-EOF && 156 $(git rev-parse E) 157 ^$(git rev-parse D) 158 EOF 159 160 test_pack_objects_reused 3 1 f && 167 git add f && 168 test_tick && 169 git commit -m "delta" && 170 delta="$(git rev-parse HEAD)" && 171 172 test_seq 64 >f && 173 test_tick && 174 git commit -a -m "base" && 175 base="$(git rev-parse HEAD)" && 176 177 test_commit other && 178 179 git repack -d && 180 181 have_delta "$(git rev-parse $delta:f)" "$(git rev-parse $base:f)" && 182 183 git multi-pack-index write --bitmap && 184 185 cat >in <<-EOF && 186 $(git rev-parse other) 187 ^$base 188 EOF 189 190 # We can only reuse the 3 objects corresponding to "other" from 191 # the latest pack. 192 # 193 # This is because even though we want "delta", we do not want 194 # "base", meaning that we have to inflate the delta/base-pair 195 # corresponding to the blob in commit "delta", which bypasses 196 # the pack-reuse mechanism. 197 # 198 # The remaining objects from the other pack are similarly not 199 # reused because their objects are on the uninteresting side of 200 # the query. 201 test_pack_objects_reused 3 1 in <<-EOF && 206 $(git rev-parse $base) 207 ^$(git rev-parse $delta) 208 EOF 209 210 P="$(git pack-objects --revs $packdir/pack p1.objects <<-EOF && 224 $(git rev-parse $base) 225 ^$(git rev-parse $delta^) 226 EOF 227 cat >p2.objects <<-EOF && 228 $(git rev-parse F) 229 EOF 230 231 p1="$(git pack-objects --revs $packdir/pack in <<-EOF && 235 pack-$p1.idx 236 pack-$p2.idx 237 EOF 238 git multi-pack-index write --bitmap --stdin-packs \ 239 --preferred-pack=pack-$p1.pack expect && 242 243 test_pack_objects_reused_all $(wc -l in && 258 p="$(git pack-objects $packdir/pack obj.raw && 280 sort -nk1 in && 281 282 # ...and create a separate pack containing just that object 283 p="$(git pack-objects $packdir/pack