@matheusbsbs / matheus-bagliano / commits / 7b1a1822fe
Fork 0

t3308: 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 7b1a1822fe4de212b486a0fbdcab0d03099e03dd
1 file changed +55 -28
t/t3308-notes-merge.sh
+55 -28
@@ -20,7 +20,34 @@ test_expect_success setup '
20 git notes add -m "Notes on 3rd commit" 3rd &&
21 git notes add -m "Notes on 4th commit" 4th &&
22 # Copy notes to remote-notes
23 - git fetch . refs/notes/*:refs/remote-notes/origin/*
23 + git fetch . refs/notes/*:refs/remote-notes/origin/* &&
24 +
25 + test_oid_init &&
26 + test_oid_cache <<-EOF
27 + hash4a sha1:5e93d24084d32e1cb61f7070505b9d2530cca987
28 + hash3a sha1:8366731eeee53787d2bdf8fc1eff7d94757e8da0
29 + hash2a sha1:eede89064cd42441590d6afec6c37b321ada3389
30 + hash1a sha1:daa55ffad6cb99bf64226532147ffcaf5ce8bdd1
31 + hash5b sha1:0f2efbd00262f2fd41dfae33df8765618eeacd99
32 + hash4b sha1:dec2502dac3ea161543f71930044deff93fa945c
33 + hash3b sha1:4069cdb399fd45463ec6eef8e051a16a03592d91
34 + hash2c sha1:d000d30e6ddcfce3a8122c403226a2ce2fd04d9d
35 + hash1c sha1:43add6bd0c8c0bc871ac7991e0f5573cfba27804
36 + hash4d sha1:1f257a3a90328557c452f0817d6cc50c89d315d4
37 + hash3d sha1:05a4927951bcef347f51486575b878b2b60137f2
38 +
39 + hash4a sha256:eef876be1d32ac2e2e42240e0429325cec116e55e88cb2969899fac695aa762f
40 + hash3a sha256:cf7cd1bc091d7ba4166a86df864110e42087cd893a5ae96bc50d637e0290939d
41 + hash2a sha256:21ddde7ebce2c285213898cb04deca0fd3209610cf7aaf8222e4e2f45262fae2
42 + hash1a sha256:f9fe0eda16c6027732ed9d4295689a03abd16f893be69b3dcbf4037ddb191921
43 + hash5b sha256:20046f2244577797a9e3d3f790ea9eca4d8a6bafb2a5570bcb0e03aa02ce100b
44 + hash4b sha256:f90563d134c61a95bb88afbd45d48ccc9e919c62aa6fbfcd483302b3e4d8dbcb
45 + hash3b sha256:988f2aca9f2d87e93e6a73197c2bb99560cc44a2f92d18653968f956f01221e0
46 + hash2c sha256:84153b777b4d42827a756c6578dcdb59d8ae5d1360b874fb37c430150c825c26
47 + hash1c sha256:9beb2bc4eef72e4c4087be168a20573e34d993d9ab1883055f23e322afa06567
48 + hash4d sha256:32de39dc06e679a7abb2d4a55ede7709b3124340a4a90aa305971b1c72ac319d
49 + hash3d sha256:fa73b20e41cbb7541c4c81d1535016131dbfbeb05bf6a71f6115e9cad31c7af5
50 + EOF
51 '
52
53 commit_sha1=$(git rev-parse 1st^{commit})
@@ -40,10 +67,10 @@ verify_notes () {
67 }
68
69 cat <<EOF | sort >expect_notes_x
43 -5e93d24084d32e1cb61f7070505b9d2530cca987 $commit_sha4
44 -8366731eeee53787d2bdf8fc1eff7d94757e8da0 $commit_sha3
45 -eede89064cd42441590d6afec6c37b321ada3389 $commit_sha2
46 -daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1
70 +$(test_oid hash4a) $commit_sha4
71 +$(test_oid hash3a) $commit_sha3
72 +$(test_oid hash2a) $commit_sha2
73 +$(test_oid hash1a) $commit_sha1
74 EOF
75
76 cat >expect_log_x <<EOF
@@ -126,10 +153,10 @@ test_expect_success 'merge previous notes commit (y^ => y) => No-op' '
153 '
154
155 cat <<EOF | sort >expect_notes_y
129 -0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5
130 -dec2502dac3ea161543f71930044deff93fa945c $commit_sha4
131 -4069cdb399fd45463ec6eef8e051a16a03592d91 $commit_sha3
132 -daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1
156 +$(test_oid hash5b) $commit_sha5
157 +$(test_oid hash4b) $commit_sha4
158 +$(test_oid hash3b) $commit_sha3
159 +$(test_oid hash1a) $commit_sha1
160 EOF
161
162 cat >expect_log_y <<EOF
@@ -193,11 +220,11 @@ test_expect_success 'merge empty notes ref (z => y)' '
220 '
221
222 cat <<EOF | sort >expect_notes_y
196 -0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5
197 -dec2502dac3ea161543f71930044deff93fa945c $commit_sha4
198 -4069cdb399fd45463ec6eef8e051a16a03592d91 $commit_sha3
199 -d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2
200 -43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1
223 +$(test_oid hash5b) $commit_sha5
224 +$(test_oid hash4b) $commit_sha4
225 +$(test_oid hash3b) $commit_sha3
226 +$(test_oid hash2c) $commit_sha2
227 +$(test_oid hash1c) $commit_sha1
228 EOF
229
230 cat >expect_log_y <<EOF
@@ -231,9 +258,9 @@ test_expect_success 'change notes on other notes ref (y)' '
258 '
259
260 cat <<EOF | sort >expect_notes_x
234 -0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5
235 -1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4
236 -daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1
261 +$(test_oid hash5b) $commit_sha5
262 +$(test_oid hash4d) $commit_sha4
263 +$(test_oid hash1a) $commit_sha1
264 EOF
265
266 cat >expect_log_x <<EOF
@@ -262,10 +289,10 @@ test_expect_success 'change notes on notes ref (x)' '
289 '
290
291 cat <<EOF | sort >expect_notes_x
265 -0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5
266 -1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4
267 -d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2
268 -43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1
292 +$(test_oid hash5b) $commit_sha5
293 +$(test_oid hash4d) $commit_sha4
294 +$(test_oid hash2c) $commit_sha2
295 +$(test_oid hash1c) $commit_sha1
296 EOF
297
298 cat >expect_log_x <<EOF
@@ -296,8 +323,8 @@ test_expect_success 'merge y into x => Non-conflicting 3-way merge' '
323 '
324
325 cat <<EOF | sort >expect_notes_w
299 -05a4927951bcef347f51486575b878b2b60137f2 $commit_sha3
300 -d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2
326 +$(test_oid hash3d) $commit_sha3
327 +$(test_oid hash2c) $commit_sha2
328 EOF
329
330 cat >expect_log_w <<EOF
@@ -326,11 +353,11 @@ test_expect_success 'create notes on new, separate notes ref (w)' '
353 '
354
355 cat <<EOF | sort >expect_notes_x
329 -0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5
330 -1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4
331 -05a4927951bcef347f51486575b878b2b60137f2 $commit_sha3
332 -d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2
333 -43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1
356 +$(test_oid hash5b) $commit_sha5
357 +$(test_oid hash4d) $commit_sha4
358 +$(test_oid hash3d) $commit_sha3
359 +$(test_oid hash2c) $commit_sha2
360 +$(test_oid hash1c) $commit_sha1
361 EOF
362
363 cat >expect_log_x <<EOF