]>
Commit | Line | Data |
---|---|---|
0b5fcb08 DS |
1 | #!/bin/sh |
2 | ||
3 | test_description="test performance of Git operations using the index" | |
4 | ||
5 | . ./perf-lib.sh | |
6 | ||
7 | test_perf_default_repo | |
8 | ||
0d53d199 | 9 | SPARSE_CONE=f2/f4 |
0b5fcb08 DS |
10 | |
11 | test_expect_success 'setup repo and indexes' ' | |
12 | git reset --hard HEAD && | |
13 | ||
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 | |
17 | then | |
18 | git rm $(awk "{print \$2}" modules) && | |
19 | git commit -m "remove submodules" || return 1 | |
20 | fi && | |
21 | ||
22 | echo bogus >a && | |
23 | cp a b && | |
24 | git add a b && | |
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}) && | |
29 | ||
0d53d199 | 30 | for i in $(test_seq 1 3) |
0b5fcb08 DS |
31 | do |
32 | cat >in <<-EOF && | |
33 | 100755 blob $BLOB a | |
34 | 040000 tree $OLD_TREE f1 | |
35 | 040000 tree $OLD_TREE f2 | |
36 | 040000 tree $OLD_TREE f3 | |
37 | 040000 tree $OLD_TREE f4 | |
38 | EOF | |
39 | NEW_TREE=$(git mktree <in) && | |
40 | NEW_COMMIT=$(git commit-tree $NEW_TREE -p $OLD_COMMIT -m "level $i") && | |
41 | OLD_TREE=$NEW_TREE && | |
42 | OLD_COMMIT=$NEW_COMMIT || return 1 | |
43 | done && | |
44 | ||
45 | git sparse-checkout init --cone && | |
748b8d66 | 46 | git tag -a v1.0 -m "Final" && |
0d53d199 DS |
47 | git sparse-checkout set $SPARSE_CONE && |
48 | git checkout -b wide $OLD_COMMIT && | |
49 | ||
50 | for l2 in f1 f2 f3 f4 | |
51 | do | |
52 | echo more bogus >>$SPARSE_CONE/$l2/a && | |
53 | git commit -a -m "edit $SPARSE_CONE/$l2/a" || return 1 | |
54 | done && | |
55 | ||
11042ab9 | 56 | git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-v3 && |
0b5fcb08 | 57 | ( |
11042ab9 | 58 | cd full-v3 && |
0b5fcb08 DS |
59 | git sparse-checkout init --cone && |
60 | git sparse-checkout set $SPARSE_CONE && | |
61 | git config index.version 3 && | |
0d53d199 DS |
62 | git update-index --index-version=3 && |
63 | git checkout HEAD~4 | |
0b5fcb08 | 64 | ) && |
11042ab9 | 65 | git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-v4 && |
0b5fcb08 | 66 | ( |
11042ab9 | 67 | cd full-v4 && |
0b5fcb08 DS |
68 | git sparse-checkout init --cone && |
69 | git sparse-checkout set $SPARSE_CONE && | |
70 | git config index.version 4 && | |
0d53d199 DS |
71 | git update-index --index-version=4 && |
72 | git checkout HEAD~4 | |
c9e40ae8 | 73 | ) && |
11042ab9 | 74 | git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-v3 && |
c9e40ae8 | 75 | ( |
11042ab9 | 76 | cd sparse-v3 && |
c9e40ae8 DS |
77 | git sparse-checkout init --cone --sparse-index && |
78 | git sparse-checkout set $SPARSE_CONE && | |
79 | git config index.version 3 && | |
0d53d199 DS |
80 | git update-index --index-version=3 && |
81 | git checkout HEAD~4 | |
c9e40ae8 | 82 | ) && |
11042ab9 | 83 | git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-v4 && |
c9e40ae8 | 84 | ( |
11042ab9 | 85 | cd sparse-v4 && |
c9e40ae8 DS |
86 | git sparse-checkout init --cone --sparse-index && |
87 | git sparse-checkout set $SPARSE_CONE && | |
88 | git config index.version 4 && | |
0d53d199 DS |
89 | git update-index --index-version=4 && |
90 | git checkout HEAD~4 | |
0b5fcb08 DS |
91 | ) |
92 | ' | |
93 | ||
94 | test_perf_on_all () { | |
95 | command="$@" | |
11042ab9 DS |
96 | for repo in full-v3 full-v4 \ |
97 | sparse-v3 sparse-v4 | |
0b5fcb08 DS |
98 | do |
99 | test_perf "$command ($repo)" " | |
100 | ( | |
101 | cd $repo && | |
102 | echo >>$SPARSE_CONE/a && | |
103 | $command | |
104 | ) | |
105 | " | |
106 | done | |
107 | } | |
108 | ||
109 | test_perf_on_all git status | |
eae93705 VD |
110 | test_perf_on_all 'git stash && git stash pop' |
111 | test_perf_on_all 'echo >>new && git stash -u && git stash pop' | |
0b5fcb08 DS |
112 | test_perf_on_all git add -A |
113 | test_perf_on_all git add . | |
114 | test_perf_on_all git commit -a -m A | |
0d53d199 | 115 | test_perf_on_all git checkout -f - |
b0b40c04 | 116 | test_perf_on_all "git sparse-checkout add f2/f3/f1 && git sparse-checkout set $SPARSE_CONE" |
291d77eb VD |
117 | test_perf_on_all git reset |
118 | test_perf_on_all git reset --hard | |
119 | test_perf_on_all git reset -- does-not-exist | |
51ba65b5 LD |
120 | test_perf_on_all git diff |
121 | test_perf_on_all git diff --cached | |
add4c864 LD |
122 | test_perf_on_all git blame $SPARSE_CONE/a |
123 | test_perf_on_all git blame $SPARSE_CONE/f3/a | |
14bf38cf | 124 | test_perf_on_all git read-tree -mu HEAD |
b553ef67 | 125 | test_perf_on_all git checkout-index -f --all |
e015d4d9 | 126 | test_perf_on_all git update-index --add --remove $SPARSE_CONE/a |
ede241c7 | 127 | test_perf_on_all "git rm -f $SPARSE_CONE/a && git checkout HEAD -- $SPARSE_CONE/a" |
d52fcf49 | 128 | test_perf_on_all git grep --cached bogus -- "f2/f1/f1/*" |
1a65b41b | 129 | test_perf_on_all git write-tree |
748b8d66 RN |
130 | test_perf_on_all git describe --dirty |
131 | test_perf_on_all 'echo >>new && git describe --dirty' | |
8c30be91 SL |
132 | test_perf_on_all git diff-files |
133 | test_perf_on_all git diff-files -- $SPARSE_CONE/a | |
48c5fbfb SL |
134 | test_perf_on_all git diff-tree HEAD |
135 | test_perf_on_all git diff-tree HEAD -- $SPARSE_CONE/a | |
8fac776f | 136 | test_perf_on_all "git worktree add ../temp && git worktree remove ../temp" |
f9815878 | 137 | test_perf_on_all git check-attr -a -- $SPARSE_CONE/a |
0b5fcb08 DS |
138 | |
139 | test_done |