@@ -24,84 +24,83 @@ TEST_PASSES_SANITIZE_LEAK=true
24
24
# the commit is identical to the commit in the other repository.
25
25
26
26
compat_hash () {
27
- case " $1 " in
28
- " sha1" )
29
- echo " sha256"
30
- ;;
31
- " sha256" )
32
- echo " sha1"
33
- ;;
34
- esac
27
+ case " $1 " in
28
+ " sha1" )
29
+ echo " sha256"
30
+ ;;
31
+ " sha256" )
32
+ echo " sha1"
33
+ ;;
34
+ esac
35
35
}
36
36
37
37
hello_oid () {
38
- case " $1 " in
39
- " sha1" )
40
- echo " $hello_sha1_oid "
41
- ;;
42
- " sha256" )
43
- echo " $hello_sha256_oid "
44
- ;;
45
- esac
38
+ case " $1 " in
39
+ " sha1" )
40
+ echo " $hello_sha1_oid "
41
+ ;;
42
+ " sha256" )
43
+ echo " $hello_sha256_oid "
44
+ ;;
45
+ esac
46
46
}
47
47
48
48
tree_oid () {
49
- case " $1 " in
50
- " sha1" )
51
- echo " $tree_sha1_oid "
52
- ;;
53
- " sha256" )
54
- echo " $tree_sha256_oid "
55
- ;;
56
- esac
49
+ case " $1 " in
50
+ " sha1" )
51
+ echo " $tree_sha1_oid "
52
+ ;;
53
+ " sha256" )
54
+ echo " $tree_sha256_oid "
55
+ ;;
56
+ esac
57
57
}
58
58
59
59
commit_oid () {
60
- case " $1 " in
61
- " sha1" )
62
- echo " $commit_sha1_oid "
63
- ;;
64
- " sha256" )
65
- echo " $commit_sha256_oid "
66
- ;;
67
- esac
60
+ case " $1 " in
61
+ " sha1" )
62
+ echo " $commit_sha1_oid "
63
+ ;;
64
+ " sha256" )
65
+ echo " $commit_sha256_oid "
66
+ ;;
67
+ esac
68
68
}
69
69
70
70
commit2_oid () {
71
- case " $1 " in
72
- " sha1" )
73
- echo " $commit2_sha1_oid "
74
- ;;
75
- " sha256" )
76
- echo " $commit2_sha256_oid "
77
- ;;
78
- esac
71
+ case " $1 " in
72
+ " sha1" )
73
+ echo " $commit2_sha1_oid "
74
+ ;;
75
+ " sha256" )
76
+ echo " $commit2_sha256_oid "
77
+ ;;
78
+ esac
79
79
}
80
80
81
81
del_sigcommit () {
82
- local delete=" $1 "
83
-
84
- if test " $delete " = " sha256" ; then
85
- local pattern=" gpgsig-sha256"
86
- else
87
- local pattern=" gpgsig"
88
- fi
89
- test-tool delete-gpgsig " $pattern "
82
+ local delete=" $1 "
83
+
84
+ if test " $delete " = " sha256" ; then
85
+ local pattern=" gpgsig-sha256"
86
+ else
87
+ local pattern=" gpgsig"
88
+ fi
89
+ test-tool delete-gpgsig " $pattern "
90
90
}
91
91
92
-
93
92
del_sigtag () {
94
- local storage=" $1 "
95
- local delete=" $2 "
96
-
97
- if test " $storage " = " $delete " ; then
98
- local pattern=" trailer"
99
- elif test " $storage " = " sha256" ; then
100
- local pattern=" gpgsig"
101
- else
102
- local pattern=" gpgsig-sha256"
103
- fi
104
- test-tool delete-gpgsig " $pattern "
93
+ local storage=" $1 "
94
+ local delete=" $2 "
95
+
96
+ if test " $storage " = " $delete " ; then
97
+ local pattern=" trailer"
98
+ elif test " $storage " = " sha256" ; then
99
+ local pattern=" gpgsig"
100
+ else
101
+ local pattern=" gpgsig-sha256"
102
+ fi
103
+ test-tool delete-gpgsig " $pattern "
105
104
}
106
105
107
106
base=$( pwd)
146
145
'
147
146
test_expect_success " create a $hash branch" '
148
147
git checkout -b branch $(commit_oid $hash) &&
149
- echo "More more more give me more!" > more &&
148
+ echo "More more more give me more!" >more &&
150
149
eval more_${hash}_oid=$(git hash-object more) &&
151
- echo "Another and another and another" > another &&
150
+ echo "Another and another and another" >another &&
152
151
eval another_${hash}_oid=$(git hash-object another) &&
153
152
git update-index --add more another &&
154
153
git commit -m "Add more files!" &&
165
164
'
166
165
test_expect_success GPG2 " create additional $hash signed commits" '
167
166
git commit --gpg-sign --allow-empty -m "This is an additional signed commit" &&
168
- git cat-file commit HEAD | del_sigcommit sha256 > "../${hash}_signedcommit3" &&
169
- git cat-file commit HEAD | del_sigcommit sha1 > "../${hash}_signedcommit4" &&
167
+ git cat-file commit HEAD | del_sigcommit sha256 >"../${hash}_signedcommit3" &&
168
+ git cat-file commit HEAD | del_sigcommit sha1 >"../${hash}_signedcommit4" &&
170
169
eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
171
170
eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
172
171
'
173
172
test_expect_success GPG2 " create additional $hash signed tags" '
174
173
git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
175
- git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 > ../${hash}_signedtag3 &&
176
- git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 > ../${hash}_signedtag4 &&
174
+ git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >../${hash}_signedtag3 &&
175
+ git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >../${hash}_signedtag4 &&
177
176
eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
178
177
eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
179
178
'
180
179
done
181
180
cd " $base "
182
181
183
182
compare_oids () {
184
- test " $# " = 5 && { local PREREQ=" $1 " ; shift ; } || PREREQ=
185
- local type=" $1 "
186
- local name=" $2 "
187
- local sha1_oid=" $3 "
188
- local sha256_oid=" $4 "
189
-
190
- echo ${sha1_oid} > ${name} _sha1_expected
191
- echo ${sha256_oid} > ${name} _sha256_expected
192
- echo ${type} > ${name} _type_expected
193
-
194
- git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name} _sha1_sha256_found
195
- git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name} _sha256_sha1_found
196
- local sha1_sha256_oid=" $( cat ${name} _sha1_sha256_found) "
197
- local sha256_sha1_oid=" $( cat ${name} _sha256_sha1_found) "
198
-
199
- test_expect_success $PREREQ " Verify ${type} ${name} 's sha1 oid" '
200
- git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha1 &&
201
- test_cmp ${name}_sha1 ${name}_sha1_expected
202
- '
203
-
204
- test_expect_success $PREREQ " Verify ${type} ${name} 's sha256 oid" '
205
- git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name}_sha256 &&
206
- test_cmp ${name}_sha256 ${name}_sha256_expected
207
- '
183
+ test " $# " = 5 && { local PREREQ=" $1 " ; shift ; } || PREREQ=
184
+ local type=" $1 "
185
+ local name=" $2 "
186
+ local sha1_oid=" $3 "
187
+ local sha256_oid=" $4 "
188
+
189
+ echo ${sha1_oid} > ${name} _sha1_expected
190
+ echo ${sha256_oid} > ${name} _sha256_expected
191
+ echo ${type} > ${name} _type_expected
192
+
193
+ git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name} _sha1_sha256_found
194
+ git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name} _sha256_sha1_found
195
+ local sha1_sha256_oid=" $( cat ${name} _sha1_sha256_found) "
196
+ local sha256_sha1_oid=" $( cat ${name} _sha256_sha1_found) "
197
+
198
+ test_expect_success $PREREQ " Verify ${type} ${name} 's sha1 oid" '
199
+ git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha1 &&
200
+ test_cmp ${name}_sha1 ${name}_sha1_expected
201
+ '
208
202
209
- test_expect_success $PREREQ " Verify ${name} 's sha1 type" '
210
- git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} > ${name}_type1 &&
211
- git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} > ${name}_type2 &&
212
- test_cmp ${name}_type1 ${name}_type2 &&
213
- test_cmp ${name}_type1 ${name}_type_expected
214
- '
203
+ test_expect_success $PREREQ " Verify ${type} ${name} 's sha256 oid" '
204
+ git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} >${name}_sha256 &&
205
+ test_cmp ${name}_sha256 ${name}_sha256_expected
206
+ '
215
207
216
- test_expect_success $PREREQ " Verify ${name} 's sha256 type" '
217
- git --git-dir=repo-sha256 /.git cat-file -t ${sha256_oid } > ${name}_type3 &&
218
- git --git-dir=repo-sha1 /.git cat-file -t ${sha1_sha256_oid } > ${name}_type4 &&
219
- test_cmp ${name}_type3 ${name}_type4 &&
220
- test_cmp ${name}_type3 ${name}_type_expected
221
- '
208
+ test_expect_success $PREREQ " Verify ${name} 's sha1 type" '
209
+ git --git-dir=repo-sha1 /.git cat-file -t ${sha1_oid } >${name}_type1 &&
210
+ git --git-dir=repo-sha256 /.git cat-file -t ${sha256_sha1_oid } >${name}_type2 &&
211
+ test_cmp ${name}_type1 ${name}_type2 &&
212
+ test_cmp ${name}_type1 ${name}_type_expected
213
+ '
222
214
223
- test_expect_success $PREREQ " Verify ${name} 's sha1 size" '
224
- git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} > ${name}_size1 &&
225
- git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} > ${name}_size2 &&
226
- test_cmp ${name}_size1 ${name}_size2
227
- '
215
+ test_expect_success $PREREQ " Verify ${name} 's sha256 type" '
216
+ git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} >${name}_type3 &&
217
+ git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} >${name}_type4 &&
218
+ test_cmp ${name}_type3 ${name}_type4 &&
219
+ test_cmp ${name}_type3 ${name}_type_expected
220
+ '
228
221
229
- test_expect_success $PREREQ " Verify ${name} 's sha256 size" '
230
- git --git-dir=repo-sha256 /.git cat-file -s ${sha256_oid } > ${name}_size3 &&
231
- git --git-dir=repo-sha1 /.git cat-file -s ${sha1_sha256_oid } > ${name}_size4 &&
232
- test_cmp ${name}_size3 ${name}_size4
233
- '
222
+ test_expect_success $PREREQ " Verify ${name} 's sha1 size" '
223
+ git --git-dir=repo-sha1 /.git cat-file -s ${sha1_oid } >${name}_size1 &&
224
+ git --git-dir=repo-sha256 /.git cat-file -s ${sha256_sha1_oid } >${name}_size2 &&
225
+ test_cmp ${name}_size1 ${name}_size2
226
+ '
234
227
235
- test_expect_success $PREREQ " Verify ${name} 's sha1 pretty content " '
236
- git --git-dir=repo-sha1 /.git cat-file -p ${sha1_oid } > ${name}_content1 &&
237
- git --git-dir=repo-sha256 /.git cat-file -p ${sha256_sha1_oid } > ${name}_content2 &&
238
- test_cmp ${name}_content1 ${name}_content2
239
- '
228
+ test_expect_success $PREREQ " Verify ${name} 's sha256 size " '
229
+ git --git-dir=repo-sha256 /.git cat-file -s ${sha256_oid } >${name}_size3 &&
230
+ git --git-dir=repo-sha1 /.git cat-file -s ${sha1_sha256_oid } >${name}_size4 &&
231
+ test_cmp ${name}_size3 ${name}_size4
232
+ '
240
233
241
- test_expect_success $PREREQ " Verify ${name} 's sha256 pretty content" '
242
- git --git-dir=repo-sha256 /.git cat-file -p ${sha256_oid } > ${name}_content3 &&
243
- git --git-dir=repo-sha1 /.git cat-file -p ${sha1_sha256_oid } > ${name}_content4 &&
244
- test_cmp ${name}_content3 ${name}_content4
245
- '
234
+ test_expect_success $PREREQ " Verify ${name} 's sha1 pretty content" '
235
+ git --git-dir=repo-sha1 /.git cat-file -p ${sha1_oid } >${name}_content1 &&
236
+ git --git-dir=repo-sha256 /.git cat-file -p ${sha256_sha1_oid } >${name}_content2 &&
237
+ test_cmp ${name}_content1 ${name}_content2
238
+ '
246
239
247
- test_expect_success $PREREQ " Verify ${name} 's sha1 content" '
248
- git --git-dir=repo-sha1 /.git cat-file ${type} ${sha1_oid } > ${name}_content5 &&
249
- git --git-dir=repo-sha256 /.git cat-file ${type} ${sha256_sha1_oid } > ${name}_content6 &&
250
- test_cmp ${name}_content5 ${name}_content6
251
- '
240
+ test_expect_success $PREREQ " Verify ${name} 's sha256 pretty content" '
241
+ git --git-dir=repo-sha256 /.git cat-file -p ${sha256_oid } >${name}_content3 &&
242
+ git --git-dir=repo-sha1 /.git cat-file -p ${sha1_sha256_oid } >${name}_content4 &&
243
+ test_cmp ${name}_content3 ${name}_content4
244
+ '
252
245
253
- test_expect_success $PREREQ " Verify ${name} 's sha256 content" '
254
- git --git-dir=repo-sha256 /.git cat-file ${type} ${sha256_oid } > ${name}_content7 &&
255
- git --git-dir=repo-sha1 /.git cat-file ${type} ${sha1_sha256_oid } > ${name}_content8 &&
256
- test_cmp ${name}_content7 ${name}_content8
257
- '
246
+ test_expect_success $PREREQ " Verify ${name} 's sha1 content" '
247
+ git --git-dir=repo-sha1 /.git cat-file ${type} ${sha1_oid } >${name}_content5 &&
248
+ git --git-dir=repo-sha256 /.git cat-file ${type} ${sha256_sha1_oid } >${name}_content6 &&
249
+ test_cmp ${name}_content5 ${name}_content6
250
+ '
258
251
252
+ test_expect_success $PREREQ " Verify ${name} 's sha256 content" '
253
+ git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} >${name}_content7 &&
254
+ git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} >${name}_content8 &&
255
+ test_cmp ${name}_content7 ${name}_content8
256
+ '
259
257
}
260
258
261
259
compare_oids ' blob' hello " $hello_sha1_oid " " $hello_sha256_oid "
0 commit comments