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/t0081-find-pack.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 / t0081-find-pack.sh` 82 lines ยท 2564 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test `test-tool find-pack`' 4 5 . ./test-lib.sh 6 7 test_expect_success 'setup' ' 8 test_commit one && 9 test_commit two && 10 test_commit three && 11 test_commit four && 12 test_commit five 13 ' 14 15 test_expect_success 'repack everything into a single packfile' ' 16 git repack -a -d --no-write-bitmap-index && 17 18 head_commit_pack=$(test-tool find-pack HEAD) && 19 head_tree_pack=$(test-tool find-pack HEAD^{tree}) && 20 one_pack=$(test-tool find-pack HEAD:one.t) && 21 three_pack=$(test-tool find-pack HEAD:three.t) && 22 old_commit_pack=$(test-tool find-pack HEAD~4) && 23 24 test-tool find-pack --check-count 1 HEAD && 25 test-tool find-pack --check-count=1 HEAD^{tree} && 26 ! test-tool find-pack --check-count=0 HEAD:one.t && 27 ! test-tool find-pack -c 2 HEAD:one.t && 28 test-tool find-pack -c 1 HEAD:three.t && 29 30 # Packfile exists at the right path 31 case "$head_commit_pack" in 32 ".git/objects/pack/pack-"*".pack") true ;; 33 *) false ;; 34 esac && 35 test_path_is_file "$head_commit_pack" && 36 37 # Everything is in the same pack 38 test "$head_commit_pack" = "$head_tree_pack" && 39 test "$head_commit_pack" = "$one_pack" && 40 test "$head_commit_pack" = "$three_pack" && 41 test "$head_commit_pack" = "$old_commit_pack" 42 ' 43 44 test_expect_success 'add more packfiles' ' 45 git rev-parse HEAD^{tree} HEAD:two.t HEAD:four.t >objects && 46 git pack-objects .git/objects/pack/mypackname1 >packhash1 objects && 49 git pack-objects .git/objects/pack/mypackname2 >packhash2 head_tree_packs && 55 test_grep "$head_commit_pack" head_tree_packs && 56 test_grep mypackname1 head_tree_packs && 57 test_grep ! mypackname2 head_tree_packs && 58 test-tool find-pack --check-count 2 HEAD^{tree} && 59 ! test-tool find-pack --check-count 1 HEAD^{tree} && 60 61 # HEAD:five.t is also in 2 packfiles 62 test-tool find-pack HEAD:five.t >five_packs && 63 test_grep "$head_commit_pack" five_packs && 64 test_grep ! mypackname1 five_packs && 65 test_grep mypackname2 five_packs && 66 test-tool find-pack -c 2 HEAD:five.t && 67 ! test-tool find-pack --check-count=0 HEAD:five.t 68 ' 69 70 test_expect_success 'add more commits (as loose objects)' ' 71 test_config maintenance.auto false && 72 test_commit six && 73 test_commit seven && 74 75 test -z "$(test-tool find-pack HEAD)" && 76 test -z "$(test-tool find-pack HEAD:six.t)" && 77 test-tool find-pack --check-count 0 HEAD && 78 test-tool find-pack -c 0 HEAD:six.t && 79 ! test-tool find-pack -c 1 HEAD:seven.t 80 ' 81 82 test_done