t3310: make test work with SHA-256
Replace the hard-coded SHA-1 constants with the use of test_oid to look up an appropriate constant for each hash algorithm. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Feb 7, 2020 at 00:52 UTC
07877f393c9dbf96af606706475662259c6a3d57
1 file changed
+58
-26
t/t3310-notes-merge-manual-resolve.sh
+58
-26
@@ -13,7 +13,39 @@ test_expect_success 'setup commits' '
13
test_commit 2nd &&
14
test_commit 3rd &&
15
test_commit 4th &&
16
- test_commit 5th
16
+ test_commit 5th &&
17
+
18
+ test_oid_cache <<-EOF
19
+ hash04a sha1:6e8e3febca3c2bb896704335cc4d0c34cb2f8715
20
+ hash03a sha1:e5388c10860456ee60673025345fe2e153eb8cf8
21
+ hash02a sha1:ceefa674873670e7ecd131814d909723cce2b669
22
+ hash04b sha1:e2bfd06a37dd2031684a59a6e2b033e212239c78
23
+ hash03b sha1:5772f42408c0dd6f097a7ca2d24de0e78d1c46b1
24
+ hash01b sha1:b0a6021ec006d07e80e9b20ec9b444cbd9d560d3
25
+ hash04c sha1:cff59c793c20bb49a4e01bc06fb06bad642e0d54
26
+ hash02c sha1:283b48219aee9a4105f6cab337e789065c82c2b9
27
+ hash01c sha1:0a81da8956346e19bcb27a906f04af327e03e31b
28
+ hash04d sha1:00494adecf2d9635a02fa431308d67993f853968
29
+ hash01e sha1:f75d1df88cbfe4258d49852f26cfc83f2ad4494b
30
+ hash04f sha1:021faa20e931fb48986ffc6282b4bb05553ac946
31
+ hash01f sha1:0a59e787e6d688aa6309e56e8c1b89431a0fc1c1
32
+ hash05g sha1:304dfb4325cf243025b9957486eb605a9b51c199
33
+
34
+ hash04a sha256:f18a935e65866345098b3b754071dbf9f3aa3520eb27a7b036b278c5e2f1ed7e
35
+ hash03a sha256:713035dc94067a64e5fa6e4e1821b7c3bde49a77c7cb3f80eaadefa1ca41b3d2
36
+ hash02a sha256:f160a67e048b6fa75bec3952184154045076692cf5dccd3da21e3fd34b7a3f0f
37
+ hash04b sha256:c7fba0d6104917fbf35258f40b9fa4fc697cfa992deecd1570a3b08d0a5587a9
38
+ hash03b sha256:7287a2d78a3766c181b08df38951d784b08b72a44f571ed6d855bd0be22c70f6
39
+ hash01b sha256:da96cf778c15d0a2bb76f98b2a62f6c9c01730fa7030e8f08ef0191048e7d620
40
+ hash04c sha256:cb615d2def4b834d5f55b2351df97dc92bee4f5009d285201427f349081c8aca
41
+ hash02c sha256:63bb527e0b4e1c8e1dd0d54dd778ca7c3718689fd6e37c473044cfbcf1cacfdb
42
+ hash01c sha256:5b87237ac1fbae0246256fed9f9a1f077c4140fb7e6444925f8dbfa5ae406cd8
43
+ hash04d sha256:eeddc9f9f6cb3d6b39b861659853f10891dc373e0b6eecb09e03e39b6ce64714
44
+ hash01e sha256:108f521b1a74c2e6d0b52a4eda87e09162bf847f7d190cfce496ee1af0b29a5a
45
+ hash04f sha256:901acda0454502b3bbd281f130c419e6c8de78afcf72a8def8d45ad31462bce4
46
+ hash01f sha256:a2d99d1b8bf23c8af7d9d91368454adc110dfd5cc068a4cebb486ee8f5a1e16c
47
+ hash05g sha256:4fef015b01da8efe929a68e3bb9b8fbad81f53995f097befe8ebc93f12ab98ec
48
+ EOF
49
'
50
51
commit_sha1=$(git rev-parse 1st^{commit})
@@ -33,9 +65,9 @@ verify_notes () {
65
}
66
67
cat <<EOF | sort >expect_notes_x
36
-6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4
37
-e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3
38
-ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2
68
+$(test_oid hash04a) $commit_sha4
69
+$(test_oid hash03a) $commit_sha3
70
+$(test_oid hash02a) $commit_sha2
71
EOF
72
73
cat >expect_log_x <<EOF
@@ -63,9 +95,9 @@ test_expect_success 'setup merge base (x)' '
95
'
96
97
cat <<EOF | sort >expect_notes_y
66
-e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
67
-5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
68
-b0a6021ec006d07e80e9b20ec9b444cbd9d560d3 $commit_sha1
98
+$(test_oid hash04b) $commit_sha4
99
+$(test_oid hash03b) $commit_sha3
100
+$(test_oid hash01b) $commit_sha1
101
EOF
102
103
cat >expect_log_y <<EOF
@@ -95,9 +127,9 @@ test_expect_success 'setup local branch (y)' '
127
'
128
129
cat <<EOF | sort >expect_notes_z
98
-cff59c793c20bb49a4e01bc06fb06bad642e0d54 $commit_sha4
99
-283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
100
-0a81da8956346e19bcb27a906f04af327e03e31b $commit_sha1
130
+$(test_oid hash04c) $commit_sha4
131
+$(test_oid hash02c) $commit_sha2
132
+$(test_oid hash01c) $commit_sha1
133
EOF
134
135
cat >expect_log_z <<EOF
@@ -193,9 +225,9 @@ test_expect_success 'merge z into m (== y) with default ("manual") resolver => C
225
'
226
227
cat <<EOF | sort >expect_notes_z
196
-00494adecf2d9635a02fa431308d67993f853968 $commit_sha4
197
-283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
198
-0a81da8956346e19bcb27a906f04af327e03e31b $commit_sha1
228
+$(test_oid hash04d) $commit_sha4
229
+$(test_oid hash02c) $commit_sha2
230
+$(test_oid hash01c) $commit_sha1
231
EOF
232
233
cat >expect_log_z <<EOF
@@ -231,8 +263,8 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
263
# Setup non-conflicting merge between x and new notes ref w
264
265
cat <<EOF | sort >expect_notes_w
234
-ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2
235
-f75d1df88cbfe4258d49852f26cfc83f2ad4494b $commit_sha1
266
+$(test_oid hash02a) $commit_sha2
267
+$(test_oid hash01e) $commit_sha1
268
EOF
269
270
cat >expect_log_w <<EOF
@@ -258,10 +290,10 @@ test_expect_success 'setup unrelated notes ref (w)' '
290
'
291
292
cat <<EOF | sort >expect_notes_w
261
-6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4
262
-e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3
263
-ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2
264
-f75d1df88cbfe4258d49852f26cfc83f2ad4494b $commit_sha1
293
+$(test_oid hash04a) $commit_sha4
294
+$(test_oid hash03a) $commit_sha3
295
+$(test_oid hash02a) $commit_sha2
296
+$(test_oid hash01e) $commit_sha1
297
EOF
298
299
cat >expect_log_w <<EOF
@@ -291,10 +323,10 @@ test_expect_success 'can do merge without conflicts even if previous merge is un
323
'
324
325
cat <<EOF | sort >expect_notes_m
294
-021faa20e931fb48986ffc6282b4bb05553ac946 $commit_sha4
295
-5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
296
-283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
297
-0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 $commit_sha1
326
+$(test_oid hash04f) $commit_sha4
327
+$(test_oid hash03b) $commit_sha3
328
+$(test_oid hash02c) $commit_sha2
329
+$(test_oid hash01f) $commit_sha1
330
EOF
331
332
cat >expect_log_m <<EOF
@@ -430,9 +462,9 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
462
'
463
464
cat <<EOF | sort >expect_notes_m
433
-304dfb4325cf243025b9957486eb605a9b51c199 $commit_sha5
434
-283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
435
-0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 $commit_sha1
465
+$(test_oid hash05g) $commit_sha5
466
+$(test_oid hash02c) $commit_sha2
467
+$(test_oid hash01f) $commit_sha1
468
EOF
469
470
cat >expect_log_m <<EOF