@matheusbsbs / matheus-bagliano / commits / 6025e898d6
Fork 0

t3309: 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 6025e898d6271723ec1a0fac2c6b239592ed6b9e
1 file changed +144 -84
t/t3309-notes-merge-auto-resolve.sh
+144 -84
@@ -23,7 +23,67 @@ test_expect_success 'setup commits' '
23 test_commit 12th &&
24 test_commit 13th &&
25 test_commit 14th &&
26 - test_commit 15th
26 + test_commit 15th &&
27 +
28 + test_oid_cache <<-EOF
29 + hash15a sha1:457a85d6c814ea208550f15fcc48f804ac8dc023
30 + hash14a sha1:b0c95b954301d69da2bc3723f4cb1680d355937c
31 + hash13a sha1:5d30216a129eeffa97d9694ffe8c74317a560315
32 + hash12a sha1:dd161bc149470fd890dd4ab52a4cbd79bbd18c36
33 + hash11a sha1:7abbc45126d680336fb24294f013a7cdfa3ed545
34 + hash10a sha1:b8d03e173f67f6505a76f6e00cf93440200dd9be
35 + hash09a sha1:20c613c835011c48a5abe29170a2402ca6354910
36 + hash08a sha1:a3daf8a1e4e5dc3409a303ad8481d57bfea7f5d6
37 + hash07a sha1:897003322b53bc6ca098e9324ee508362347e734
38 + hash06a sha1:11d97fdebfa5ceee540a3da07bce6fa0222bc082
39 + hash15b sha1:68b8630d25516028bed862719855b3d6768d7833
40 + hash14b sha1:5de7ea7ad4f47e7ff91989fb82234634730f75df
41 + hash13b sha1:3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc
42 + hash12b sha1:a66055fa82f7a03fe0c02a6aba3287a85abf7c62
43 + hash05b sha1:154508c7a0bcad82b6fe4b472bc4c26b3bf0825b
44 + hash04b sha1:e2bfd06a37dd2031684a59a6e2b033e212239c78
45 + hash03b sha1:5772f42408c0dd6f097a7ca2d24de0e78d1c46b1
46 + hash15c sha1:9b4b2c61f0615412da3c10f98ff85b57c04ec765
47 + hash11c sha1:7e3c53503a3db8dd996cb62e37c66e070b44b54d
48 + hash08c sha1:851e1638784a884c7dd26c5d41f3340f6387413a
49 + hash05c sha1:99fc34adfc400b95c67b013115e37e31aa9a6d23
50 + hash02c sha1:283b48219aee9a4105f6cab337e789065c82c2b9
51 + hash15d sha1:7c4e546efd0fe939f876beb262ece02797880b54
52 + hash05d sha1:6c841cc36ea496027290967ca96bd2bef54dbb47
53 + hash15e sha1:d682107b8bf7a7aea1e537a8d5cb6a12b60135f1
54 + hash05e sha1:357b6ca14c7afd59b7f8b8aaaa6b8b723771135b
55 + hash15f sha1:6be90240b5f54594203e25d9f2f64b7567175aee
56 + hash05f sha1:660311d7f78dc53db12ac373a43fca7465381a7e
57 +
58 + hash15a sha256:45b1558e5c1b75f570010fa48aaa67bb2289fcd431b34ad81cb4c8b95f4f872a
59 + hash14a sha256:6e7af179ea4dd28afdc83ae6912ba0098cdeff764b26a8b750b157dd81749092
60 + hash13a sha256:7353089961baf555388e1bac68c67c8ea94b08ccbd97532201cf7f6790703052
61 + hash12a sha256:5863e4521689ee1879ceab3b38d39e93ab5b51ec70aaf6a96ad388fbdedfa25e
62 + hash11a sha256:82a0ec0338b4ecf8b44304badf4ad38d7469dc41827f38d7ba6c42e3bae3ee98
63 + hash10a sha256:e84f2564e92de9792c93b8d197262c735d7ccb1de6025cef8759af8f6c3308eb
64 + hash09a sha256:4dd07764bcec696f195c0ea71ae89e174876403af1637e4642b8f4453fd23028
65 + hash08a sha256:02132c4546cd88a1d0aa5854dd55da120927f7904ba16afe36fe03e91a622067
66 + hash07a sha256:369baf7d00c6720efdc10273493555f943051f84a4706fb24caeb353fa4789db
67 + hash06a sha256:52d32c10353583b2d96a5849b1f1f43c8018e76f3e8ef1b0d46eb5cff7cdefaf
68 + hash15b sha256:345e6660b345fa174738a31a7a59423c394bdf414804e200bc510c65d971ae96
69 + hash14b sha256:7653a6596021c52e405cba979eea15a729993e7102b9a61ba4667e34f0ead4a1
70 + hash13b sha256:0f202a0b6b9690de2349c173dfd766a37e82744f61c14f1c389306f1d69f470b
71 + hash12b sha256:eb00f219c026136ea6535b16ff8ec3efa510e6bf50098ca041e1a2a1d4b79840
72 + hash05b sha256:993b2290cd0c24c27c849d99f1904f3b590f77af0f539932734ad05679ac5a2f
73 + hash04b sha256:c7fba0d6104917fbf35258f40b9fa4fc697cfa992deecd1570a3b08d0a5587a9
74 + hash03b sha256:7287a2d78a3766c181b08df38951d784b08b72a44f571ed6d855bd0be22c70f6
75 + hash15c sha256:62316660a22bf97857dc4a16709ec4d93a224e8c9f37d661ef91751e1f4c4166
76 + hash11c sha256:51c3763de9b08309370adc5036d58debb331980e73097902957c444602551daa
77 + hash08c sha256:22cf1fa29599898a7218c51135d66ed85d22aad584f77db3305dedce4c3d4798
78 + hash05c sha256:2508fd86db980f0508893a1c1571bdf3b2ee113dc25ddb1a3a2fb94bd6cd0d58
79 + hash02c sha256:63bb527e0b4e1c8e1dd0d54dd778ca7c3718689fd6e37c473044cfbcf1cacfdb
80 + hash15d sha256:667acb4e2d5f8df15e5aea4506dfd16d25bc7feca70fdb0d965a7222f983bb88
81 + hash05d sha256:09e6b5a6fe666c4a027674b6611a254b7d2528cd211c6b5288d1b4db6c741dfa
82 + hash15e sha256:e8cbf52f6fcadc6de3c7761e64a89e9fe38d19a03d3e28ef6ca8596d93fc4f3a
83 + hash05e sha256:cdb1e19f7ba1539f95af51a57edeb88a7ecc97d3c2f52da8c4c86af308595607
84 + hash15f sha256:29c14cb92da448a923963b8a43994268b19c2e57913de73f3667421fd2c0eeec
85 + hash05f sha256:14a6e641b2c0a9f398ebac6b4d34afa5efea4c52d2631382f45f8f662266903b
86 + EOF
87 '
88
89 commit_sha1=$(git rev-parse 1st^{commit})
@@ -68,16 +128,16 @@ test_expect_success 'setup merge base (x)' '
128 '
129
130 cat <<EOF | sort >expect_notes_x
71 -457a85d6c814ea208550f15fcc48f804ac8dc023 $commit_sha15
72 -b0c95b954301d69da2bc3723f4cb1680d355937c $commit_sha14
73 -5d30216a129eeffa97d9694ffe8c74317a560315 $commit_sha13
74 -dd161bc149470fd890dd4ab52a4cbd79bbd18c36 $commit_sha12
75 -7abbc45126d680336fb24294f013a7cdfa3ed545 $commit_sha11
76 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
77 -20c613c835011c48a5abe29170a2402ca6354910 $commit_sha9
78 -a3daf8a1e4e5dc3409a303ad8481d57bfea7f5d6 $commit_sha8
79 -897003322b53bc6ca098e9324ee508362347e734 $commit_sha7
80 -11d97fdebfa5ceee540a3da07bce6fa0222bc082 $commit_sha6
131 +$(test_oid hash15a) $commit_sha15
132 +$(test_oid hash14a) $commit_sha14
133 +$(test_oid hash13a) $commit_sha13
134 +$(test_oid hash12a) $commit_sha12
135 +$(test_oid hash11a) $commit_sha11
136 +$(test_oid hash10a) $commit_sha10
137 +$(test_oid hash09a) $commit_sha9
138 +$(test_oid hash08a) $commit_sha8
139 +$(test_oid hash07a) $commit_sha7
140 +$(test_oid hash06a) $commit_sha6
141 EOF
142
143 cat >expect_log_x <<EOF
@@ -141,16 +201,16 @@ test_expect_success 'setup local branch (y)' '
201 '
202
203 cat <<EOF | sort >expect_notes_y
144 -68b8630d25516028bed862719855b3d6768d7833 $commit_sha15
145 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
146 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
147 -a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12
148 -7abbc45126d680336fb24294f013a7cdfa3ed545 $commit_sha11
149 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
150 -20c613c835011c48a5abe29170a2402ca6354910 $commit_sha9
151 -154508c7a0bcad82b6fe4b472bc4c26b3bf0825b $commit_sha5
152 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
153 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
204 +$(test_oid hash15b) $commit_sha15
205 +$(test_oid hash14b) $commit_sha14
206 +$(test_oid hash13b) $commit_sha13
207 +$(test_oid hash12b) $commit_sha12
208 +$(test_oid hash11a) $commit_sha11
209 +$(test_oid hash10a) $commit_sha10
210 +$(test_oid hash09a) $commit_sha9
211 +$(test_oid hash05b) $commit_sha5
212 +$(test_oid hash04b) $commit_sha4
213 +$(test_oid hash03b) $commit_sha3
214 EOF
215
216 cat >expect_log_y <<EOF
@@ -214,16 +274,16 @@ test_expect_success 'setup remote branch (z)' '
274 '
275
276 cat <<EOF | sort >expect_notes_z
217 -9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15
218 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
219 -5d30216a129eeffa97d9694ffe8c74317a560315 $commit_sha13
220 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
221 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
222 -851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8
223 -897003322b53bc6ca098e9324ee508362347e734 $commit_sha7
224 -99fc34adfc400b95c67b013115e37e31aa9a6d23 $commit_sha5
225 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
226 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
277 +$(test_oid hash15c) $commit_sha15
278 +$(test_oid hash14b) $commit_sha14
279 +$(test_oid hash13a) $commit_sha13
280 +$(test_oid hash11c) $commit_sha11
281 +$(test_oid hash10a) $commit_sha10
282 +$(test_oid hash08c) $commit_sha8
283 +$(test_oid hash07a) $commit_sha7
284 +$(test_oid hash05c) $commit_sha5
285 +$(test_oid hash04b) $commit_sha4
286 +$(test_oid hash02c) $commit_sha2
287 EOF
288
289 cat >expect_log_z <<EOF
@@ -306,16 +366,16 @@ test_expect_success 'merge z into y with invalid configuration option => Fail/No
366 '
367
368 cat <<EOF | sort >expect_notes_ours
309 -68b8630d25516028bed862719855b3d6768d7833 $commit_sha15
310 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
311 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
312 -a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12
313 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
314 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
315 -154508c7a0bcad82b6fe4b472bc4c26b3bf0825b $commit_sha5
316 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
317 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
318 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
369 +$(test_oid hash15b) $commit_sha15
370 +$(test_oid hash14b) $commit_sha14
371 +$(test_oid hash13b) $commit_sha13
372 +$(test_oid hash12b) $commit_sha12
373 +$(test_oid hash11c) $commit_sha11
374 +$(test_oid hash10a) $commit_sha10
375 +$(test_oid hash05b) $commit_sha5
376 +$(test_oid hash04b) $commit_sha4
377 +$(test_oid hash03b) $commit_sha3
378 +$(test_oid hash02c) $commit_sha2
379 EOF
380
381 cat >expect_log_ours <<EOF
@@ -395,16 +455,16 @@ test_expect_success 'reset to pre-merge state (y)' '
455 '
456
457 cat <<EOF | sort >expect_notes_theirs
398 -9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15
399 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
400 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
401 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
402 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
403 -851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8
404 -99fc34adfc400b95c67b013115e37e31aa9a6d23 $commit_sha5
405 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
406 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
407 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
458 +$(test_oid hash15c) $commit_sha15
459 +$(test_oid hash14b) $commit_sha14
460 +$(test_oid hash13b) $commit_sha13
461 +$(test_oid hash11c) $commit_sha11
462 +$(test_oid hash10a) $commit_sha10
463 +$(test_oid hash08c) $commit_sha8
464 +$(test_oid hash05c) $commit_sha5
465 +$(test_oid hash04b) $commit_sha4
466 +$(test_oid hash03b) $commit_sha3
467 +$(test_oid hash02c) $commit_sha2
468 EOF
469
470 cat >expect_log_theirs <<EOF
@@ -473,17 +533,17 @@ test_expect_success 'reset to pre-merge state (y)' '
533 '
534
535 cat <<EOF | sort >expect_notes_union
476 -7c4e546efd0fe939f876beb262ece02797880b54 $commit_sha15
477 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
478 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
479 -a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12
480 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
481 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
482 -851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8
483 -6c841cc36ea496027290967ca96bd2bef54dbb47 $commit_sha5
484 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
485 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
486 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
536 +$(test_oid hash15d) $commit_sha15
537 +$(test_oid hash14b) $commit_sha14
538 +$(test_oid hash13b) $commit_sha13
539 +$(test_oid hash12b) $commit_sha12
540 +$(test_oid hash11c) $commit_sha11
541 +$(test_oid hash10a) $commit_sha10
542 +$(test_oid hash08c) $commit_sha8
543 +$(test_oid hash05d) $commit_sha5
544 +$(test_oid hash04b) $commit_sha4
545 +$(test_oid hash03b) $commit_sha3
546 +$(test_oid hash02c) $commit_sha2
547 EOF
548
549 cat >expect_log_union <<EOF
@@ -574,17 +634,17 @@ test_expect_success 'merge z into y with "manual" per-ref only checks specific r
634 '
635
636 cat <<EOF | sort >expect_notes_union2
577 -d682107b8bf7a7aea1e537a8d5cb6a12b60135f1 $commit_sha15
578 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
579 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
580 -a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12
581 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
582 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
583 -851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8
584 -357b6ca14c7afd59b7f8b8aaaa6b8b723771135b $commit_sha5
585 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
586 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
587 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
637 +$(test_oid hash15e) $commit_sha15
638 +$(test_oid hash14b) $commit_sha14
639 +$(test_oid hash13b) $commit_sha13
640 +$(test_oid hash12b) $commit_sha12
641 +$(test_oid hash11c) $commit_sha11
642 +$(test_oid hash10a) $commit_sha10
643 +$(test_oid hash08c) $commit_sha8
644 +$(test_oid hash05e) $commit_sha5
645 +$(test_oid hash04b) $commit_sha4
646 +$(test_oid hash03b) $commit_sha3
647 +$(test_oid hash02c) $commit_sha2
648 EOF
649
650 cat >expect_log_union2 <<EOF
@@ -648,17 +708,17 @@ test_expect_success 'reset to pre-merge state (z)' '
708 '
709
710 cat <<EOF | sort >expect_notes_cat_sort_uniq
651 -6be90240b5f54594203e25d9f2f64b7567175aee $commit_sha15
652 -5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
653 -3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13
654 -a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12
655 -7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11
656 -b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10
657 -851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8
658 -660311d7f78dc53db12ac373a43fca7465381a7e $commit_sha5
659 -e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4
660 -5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3
661 -283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2
711 +$(test_oid hash15f) $commit_sha15
712 +$(test_oid hash14b) $commit_sha14
713 +$(test_oid hash13b) $commit_sha13
714 +$(test_oid hash12b) $commit_sha12
715 +$(test_oid hash11c) $commit_sha11
716 +$(test_oid hash10a) $commit_sha10
717 +$(test_oid hash08c) $commit_sha8
718 +$(test_oid hash05f) $commit_sha5
719 +$(test_oid hash04b) $commit_sha4
720 +$(test_oid hash03b) $commit_sha3
721 +$(test_oid hash02c) $commit_sha2
722 EOF
723
724 cat >expect_log_cat_sort_uniq <<EOF