| 1 | # test_midx_consistent <objdir> |
| 2 | test_midx_consistent () { |
| 3 | ls $1/pack/pack-*.idx | xargs -n 1 basename | sort >expect && |
| 4 | test-tool read-midx $1 | grep ^pack-.*\.idx$ | sort >actual && |
| 5 | |
| 6 | test_cmp expect actual && |
| 7 | git multi-pack-index --object-dir=$1 verify |
| 8 | } |
| 9 | |
| 10 | midx_checksum () { |
| 11 | test-tool read-midx --checksum "$1" |
| 12 | } |
| 13 | |
| 14 | midx_git_two_modes () { |
| 15 | git -c core.multiPackIndex=false $1 >expect && |
| 16 | git -c core.multiPackIndex=true $1 >actual && |
| 17 | if [ "$2" = "sorted" ] |
| 18 | then |
| 19 | sort <expect >expect.sorted && |
| 20 | mv expect.sorted expect && |
| 21 | sort <actual >actual.sorted && |
| 22 | mv actual.sorted actual |
| 23 | fi && |
| 24 | test_cmp expect actual |
| 25 | } |
| 26 | |
| 27 | compare_results_with_midx () { |
| 28 | MSG=$1 |
| 29 | test_expect_success "check normal git operations: $MSG" ' |
| 30 | midx_git_two_modes "rev-list --objects --all" && |
| 31 | midx_git_two_modes "log --raw" && |
| 32 | midx_git_two_modes "count-objects --verbose" && |
| 33 | midx_git_two_modes "cat-file --batch-all-objects --batch-check" && |
| 34 | midx_git_two_modes "cat-file --batch-all-objects --batch-check --unordered" sorted |
| 35 | ' |
| 36 | } |