3 test_description
="test performance of Git operations using the index"
11 test_expect_success
'setup repo and indexes' '
12 git reset --hard HEAD &&
14 # Remove submodules from the example repo, because our
15 # duplication of the entire repo creates an unlikely data shape.
16 if git config --file .gitmodules --get-regexp "submodule.*.path" >modules
18 git rm $(awk "{print \$2}" modules) &&
19 git commit -m "remove submodules" || return 1
25 git commit -m "level 0" &&
26 BLOB=$(git rev-parse HEAD:a) &&
27 OLD_COMMIT=$(git rev-parse HEAD) &&
28 OLD_TREE=$(git rev-parse HEAD^{tree}) &&
30 for i in $(test_seq 1 4)
34 040000 tree $OLD_TREE f1
35 040000 tree $OLD_TREE f2
36 040000 tree $OLD_TREE f3
37 040000 tree $OLD_TREE f4
39 NEW_TREE=$(git mktree <in) &&
40 NEW_COMMIT=$(git commit-tree $NEW_TREE -p $OLD_COMMIT -m "level $i") &&
42 OLD_COMMIT=$NEW_COMMIT || return 1
45 git sparse-checkout init --cone &&
46 git branch -f wide $OLD_COMMIT &&
47 git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v3 &&
50 git sparse-checkout init --cone &&
51 git sparse-checkout set $SPARSE_CONE &&
52 git config index.version 3 &&
53 git update-index --index-version=3
55 git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v4 &&
58 git sparse-checkout init --cone &&
59 git sparse-checkout set $SPARSE_CONE &&
60 git config index.version 4 &&
61 git update-index --index-version=4
63 git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v3 &&
66 git sparse-checkout init --cone --sparse-index &&
67 git sparse-checkout set $SPARSE_CONE &&
68 git config index.version 3 &&
69 git update-index --index-version=3
71 git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v4 &&
74 git sparse-checkout init --cone --sparse-index &&
75 git sparse-checkout set $SPARSE_CONE &&
76 git config index.version 4 &&
77 git update-index --index-version=4
83 for repo
in full-index-v3 full-index-v4 \
84 sparse-index-v3 sparse-index-v4
86 test_perf
"$command ($repo)" "
89 echo >>$SPARSE_CONE/a &&
96 test_perf_on_all git status
97 test_perf_on_all git add
-A
98 test_perf_on_all git add .
99 test_perf_on_all git commit
-a -m A