blob 00be852ed33cbcb144f6e8fe1a789207f100dd8e 5920 bytes (raw)
name: t/t5318-midx.sh # note: path name is non-authoritative(*)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
| | #!/bin/sh
test_description='multi-pack indexes'
. ./test-lib.sh
test_expect_success 'config' \
'rm -rf .git &&
mkdir full &&
cd full &&
git init &&
git config core.midx true &&
git config pack.threads 1 &&
packdir=.git/objects/pack'
test_expect_success 'write-midx with no packs' \
'midx0=$(git midx --write) &&
test "a$midx0" = "a"'
test_expect_success 'create objects' \
'for i in $(test_seq 100)
do
echo $i >file-1-$i
done &&
git add file-* &&
test_tick &&
git commit -m "test data 1" &&
git branch commit1 HEAD'
_midx_read_expect() {
cat >expect <<- EOF
header: 4d494458 1 1 20 0 5 $1
num_objects: $2
chunks: pack_lookup pack_names oid_fanout oid_lookup object_offsets
pack_names:
$(ls $3 | grep pack | grep -v idx | sort)
pack_dir: $3
EOF
}
_midx_git_two_modes() {
git -c core.midx=true $1 >output
git -c core.midx=false $1 >expect
}
_midx_git_behavior() {
test_expect_success 'check normal git operations' \
'_midx_git_two_modes "log --patch master" &&
cmp output expect &&
_midx_git_two_modes "rev-list --all --objects" &&
cmp output expect'
}
test_expect_success 'write-midx from index version 1' \
'pack1=$(git rev-list --all --objects | git pack-objects --index-version=1 ${packdir}/test-1) &&
midx1=$(git midx --write) &&
test_path_is_file ${packdir}/midx-${midx1}.midx &&
test_path_is_missing ${packdir}/midx-head &&
_midx_read_expect \
"1" "102" \
"${packdir}" &&
git midx --read --midx-id=${midx1} >output &&
cmp output expect'
_midx_git_behavior
test_expect_success 'write-midx from index version 2' \
'rm "${packdir}/test-1-${pack1}.pack" &&
pack2=$(git rev-list --all --objects | git pack-objects --index-version=2 ${packdir}/test-2) &&
midx2=$(git midx --write --update-head) &&
test_path_is_file ${packdir}/midx-${midx2}.midx &&
test_path_is_file ${packdir}/midx-head &&
test $(cat ${packdir}/midx-head) = "$midx2" &&
_midx_read_expect \
"1" "102" \
"${packdir}" &&
git midx --read> output &&
cmp output expect'
_midx_git_behavior
test_expect_success 'Create more objects' \
'for i in $(test_seq 100)
do
echo extra-$i >file-2-$i
done &&
git add file-* &&
test_tick &&
git commit -m "test data 2" &&
git branch commit2 HEAD'
_midx_git_behavior
test_expect_success 'write-midx with two packs' \
'pack3=$(git rev-list --objects commit2 ^commit1 | git pack-objects --index-version=2 ${packdir}/test-3) &&
midx3=$(git midx --write --update-head) &&
test_path_is_file ${packdir}/midx-${midx3}.midx &&
test_path_is_file ${packdir}/midx-${midx2}.midx &&
test_path_is_file ${packdir}/midx-head &&
test $(cat ${packdir}/midx-head) = "$midx3" &&
_midx_read_expect \
"2" "204" \
"${packdir}" &&
git midx --read >output &&
cmp output expect'
_midx_git_behavior
test_expect_success 'Add more packs' \
'for i in $(test_seq 10)
do
iii=$(printf '%03i' $i)
test-genrandom "bar" 200 > wide_delta_$iii &&
test-genrandom "baz $iii" 50 >> wide_delta_$iii &&
test-genrandom "foo"$i 100 > deep_delta_$iii &&
test-genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
test-genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
echo $iii >file_$iii &&
test-genrandom "$iii" 8192 >>file_$iii &&
git update-index --add file_$iii deep_delta_$iii wide_delta_$iii &&
{ echo 101 && test-genrandom 100 8192; } >file_101 &&
git update-index --add file_101 &&
tree=$(git write-tree) &&
commit=$(git commit-tree $tree -p HEAD</dev/null) && {
echo $tree &&
git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
} >obj-list &&
git update-ref HEAD $commit &&
git pack-objects --index-version=2 ${packdir}/test-pack <obj-list
done'
_midx_git_behavior
test_expect_success 'write-midx with twelve packs' \
'midx4=$(git midx --write --update-head --delete-expired) &&
test_path_is_file ${packdir}/midx-${midx4}.midx &&
test_path_is_missing ${packdir}/midx-${midx3}.midx &&
test_path_is_file ${packdir}/midx-${midx2}.midx &&
test_path_is_file ${packdir}/midx-head &&
test $(cat ${packdir}/midx-head) = "$midx4" &&
_midx_read_expect \
"12" "245" \
"${packdir}" &&
git midx --read >output &&
cmp output expect'
_midx_git_behavior
test_expect_success 'write-midx with no new packs' \
'midx5=$(git midx --write --update-head --delete-expired) &&
test_path_is_file ${packdir}/midx-${midx5}.midx &&
test "a$midx4" = "a$midx5" &&
test_path_is_file ${packdir}/midx-head &&
test $(cat ${packdir}/midx-head) = "$midx4"'
_midx_git_behavior
test_expect_success 'create bare repo' \
'cd .. &&
git clone --bare full bare &&
cd bare &&
git config core.midx true &&
git config pack.threads 1 &&
baredir=./objects/pack'
test_expect_success 'write-midx in bare repo' \
'midxbare=$(git midx --write --update-head --delete-expired) &&
test_path_is_file ${baredir}/midx-${midxbare}.midx &&
test_path_is_file ${baredir}/midx-head &&
test $(cat ${baredir}/midx-head) = "$midxbare" &&
_midx_read_expect \
"12" "245" \
"${baredir}" &&
git midx --read >output &&
cmp output expect'
_midx_git_behavior
test_expect_success 'midx --clear' \
'git midx --clear &&
test_path_is_missing "${baredir}/midx-${midx4}.midx" &&
test_path_is_missing "${baredir}/midx-head" &&
cd ../full &&
git midx --clear &&
test_path_is_missing "${packdir}/midx-${midx4}.midx" &&
test_path_is_missing "${packdir}/midx-head"'
_midx_git_behavior
test_done
|
debug log:
solving 00be852ed3 ...
found 00be852ed3 in https://public-inbox.org/git/20180107181459.222909-14-dstolee@microsoft.com/
found 42d103c879 in https://public-inbox.org/git/20180107181459.222909-13-dstolee@microsoft.com/
found 9337355ab3 in https://public-inbox.org/git/20180107181459.222909-12-dstolee@microsoft.com/
found 2e52389442 in https://public-inbox.org/git/20180107181459.222909-9-dstolee@microsoft.com/
found b66efcdce9 in https://public-inbox.org/git/20180107181459.222909-8-dstolee@microsoft.com/
found 869bbea29c in https://public-inbox.org/git/20180107181459.222909-7-dstolee@microsoft.com/
applying [1/6] https://public-inbox.org/git/20180107181459.222909-7-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
new file mode 100755
index 0000000000..869bbea29c
applying [2/6] https://public-inbox.org/git/20180107181459.222909-8-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index 869bbea29c..b66efcdce9 100755
applying [3/6] https://public-inbox.org/git/20180107181459.222909-9-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index b66efcdce9..2e52389442 100755
applying [4/6] https://public-inbox.org/git/20180107181459.222909-12-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index 2e52389442..9337355ab3 100755
applying [5/6] https://public-inbox.org/git/20180107181459.222909-13-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index 9337355ab3..42d103c879 100755
applying [6/6] https://public-inbox.org/git/20180107181459.222909-14-dstolee@microsoft.com/
diff --git a/t/t5318-midx.sh b/t/t5318-midx.sh
index 42d103c879..00be852ed3 100755
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
Checking patch t/t5318-midx.sh...
Applied patch t/t5318-midx.sh cleanly.
index at:
100755 00be852ed33cbcb144f6e8fe1a789207f100dd8e t/t5318-midx.sh
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).