@matheusbsbs / matheus-bagliano / commits / 866be6ece4
Fork 0

t7063: make hash size independent

Use test_oid instead of hard-coding algorithm-specific constants and all-zero values. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jul 29, 2020 at 23:14 UTC 866be6ece467187879e256ea87294683dfe191ce
1 file changed +80 -70
t/t7063-status-untracked-cache.sh
+80 -70
@@ -75,14 +75,24 @@ test_expect_success 'setup' '
75 touch one two three done/one dtwo/two dthree/three &&
76 git add one two done/one &&
77 : >.git/info/exclude &&
78 - git update-index --untracked-cache
78 + git update-index --untracked-cache &&
79 + test_oid_cache <<-EOF
80 + root sha1:e6fcc8f2ee31bae321d66afd183fcb7237afae6e
81 + root sha256:b90c672088c015b9c83876e919da311bad4cd39639fb139f988af6a11493b974
82 +
83 + exclude sha1:13263c0978fb9fad16b2d580fb800b6d811c3ff0
84 + exclude sha256:fe4aaa1bbbbce4cb8f73426748a14c5ad6026b26f90505a0bf2494b165a5b76c
85 +
86 + done sha1:1946f0437f90c5005533cbe1736a6451ca301714
87 + done sha256:7f079501d79f665b3acc50f5e0e9e94509084d5032ac20113a37dd5029b757cc
88 + EOF
89 '
90
91 test_expect_success 'untracked cache is empty' '
92 test-tool dump-untracked-cache >../actual &&
93 cat >../expect-empty <<EOF &&
84 -info/exclude 0000000000000000000000000000000000000000
85 -core.excludesfile 0000000000000000000000000000000000000000
94 +info/exclude $ZERO_OID
95 +core.excludesfile $ZERO_OID
96 exclude_per_dir .gitignore
97 flags 00000006
98 EOF
@@ -100,17 +110,17 @@ EOF
110
111 cat >../dump.expect <<EOF &&
112 info/exclude $EMPTY_BLOB
103 -core.excludesfile 0000000000000000000000000000000000000000
113 +core.excludesfile $ZERO_OID
114 exclude_per_dir .gitignore
115 flags 00000006
106 -/ 0000000000000000000000000000000000000000 recurse valid
116 +/ $ZERO_OID recurse valid
117 dthree/
118 dtwo/
119 three
110 -/done/ 0000000000000000000000000000000000000000 recurse valid
111 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
120 +/done/ $ZERO_OID recurse valid
121 +/dthree/ $ZERO_OID recurse check_only valid
122 three
113 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
123 +/dtwo/ $ZERO_OID recurse check_only valid
124 two
125 EOF
126
@@ -190,18 +200,18 @@ test_expect_success 'verify untracked cache dump' '
200 test-tool dump-untracked-cache >../actual &&
201 cat >../expect <<EOF &&
202 info/exclude $EMPTY_BLOB
193 -core.excludesfile 0000000000000000000000000000000000000000
203 +core.excludesfile $ZERO_OID
204 exclude_per_dir .gitignore
205 flags 00000006
196 -/ 0000000000000000000000000000000000000000 recurse valid
206 +/ $ZERO_OID recurse valid
207 dthree/
208 dtwo/
209 four
210 three
201 -/done/ 0000000000000000000000000000000000000000 recurse valid
202 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
211 +/done/ $ZERO_OID recurse valid
212 +/dthree/ $ZERO_OID recurse check_only valid
213 three
204 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
214 +/dtwo/ $ZERO_OID recurse check_only valid
215 two
216 EOF
217 test_cmp ../expect ../actual
@@ -239,18 +249,18 @@ test_expect_success 'verify untracked cache dump' '
249 test-tool dump-untracked-cache >../actual &&
250 cat >../expect <<EOF &&
251 info/exclude $EMPTY_BLOB
242 -core.excludesfile 0000000000000000000000000000000000000000
252 +core.excludesfile $ZERO_OID
253 exclude_per_dir .gitignore
254 flags 00000006
245 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
255 +/ $(test_oid root) recurse valid
256 .gitignore
257 dthree/
258 dtwo/
259 three
250 -/done/ 0000000000000000000000000000000000000000 recurse valid
251 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
260 +/done/ $ZERO_OID recurse valid
261 +/dthree/ $ZERO_OID recurse check_only valid
262 three
253 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
263 +/dtwo/ $ZERO_OID recurse check_only valid
264 two
265 EOF
266 test_cmp ../expect ../actual
@@ -284,16 +294,16 @@ EOF
294 test_expect_success 'verify untracked cache dump' '
295 test-tool dump-untracked-cache >../actual &&
296 cat >../expect <<EOF &&
287 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
288 -core.excludesfile 0000000000000000000000000000000000000000
297 +info/exclude $(test_oid exclude)
298 +core.excludesfile $ZERO_OID
299 exclude_per_dir .gitignore
300 flags 00000006
291 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
301 +/ $(test_oid root) recurse valid
302 .gitignore
303 dtwo/
294 -/done/ 0000000000000000000000000000000000000000 recurse valid
295 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
296 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
304 +/done/ $ZERO_OID recurse valid
305 +/dthree/ $ZERO_OID recurse check_only valid
306 +/dtwo/ $ZERO_OID recurse check_only valid
307 two
308 EOF
309 test_cmp ../expect ../actual
@@ -303,14 +313,14 @@ test_expect_success 'move two from tracked to untracked' '
313 git rm --cached two &&
314 test-tool dump-untracked-cache >../actual &&
315 cat >../expect <<EOF &&
306 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
307 -core.excludesfile 0000000000000000000000000000000000000000
316 +info/exclude $(test_oid exclude)
317 +core.excludesfile $ZERO_OID
318 exclude_per_dir .gitignore
319 flags 00000006
310 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse
311 -/done/ 0000000000000000000000000000000000000000 recurse valid
312 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
313 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
320 +/ $(test_oid root) recurse
321 +/done/ $ZERO_OID recurse valid
322 +/dthree/ $ZERO_OID recurse check_only valid
323 +/dtwo/ $ZERO_OID recurse check_only valid
324 two
325 EOF
326 test_cmp ../expect ../actual
@@ -342,17 +352,17 @@ EOF
352 test_expect_success 'verify untracked cache dump' '
353 test-tool dump-untracked-cache >../actual &&
354 cat >../expect <<EOF &&
345 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
346 -core.excludesfile 0000000000000000000000000000000000000000
355 +info/exclude $(test_oid exclude)
356 +core.excludesfile $ZERO_OID
357 exclude_per_dir .gitignore
358 flags 00000006
349 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
359 +/ $(test_oid root) recurse valid
360 .gitignore
361 dtwo/
362 two
353 -/done/ 0000000000000000000000000000000000000000 recurse valid
354 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
355 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
363 +/done/ $ZERO_OID recurse valid
364 +/dthree/ $ZERO_OID recurse check_only valid
365 +/dtwo/ $ZERO_OID recurse check_only valid
366 two
367 EOF
368 test_cmp ../expect ../actual
@@ -362,14 +372,14 @@ test_expect_success 'move two from untracked to tracked' '
372 git add two &&
373 test-tool dump-untracked-cache >../actual &&
374 cat >../expect <<EOF &&
365 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
366 -core.excludesfile 0000000000000000000000000000000000000000
375 +info/exclude $(test_oid exclude)
376 +core.excludesfile $ZERO_OID
377 exclude_per_dir .gitignore
378 flags 00000006
369 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse
370 -/done/ 0000000000000000000000000000000000000000 recurse valid
371 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
372 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
379 +/ $(test_oid root) recurse
380 +/done/ $ZERO_OID recurse valid
381 +/dthree/ $ZERO_OID recurse check_only valid
382 +/dtwo/ $ZERO_OID recurse check_only valid
383 two
384 EOF
385 test_cmp ../expect ../actual
@@ -401,16 +411,16 @@ EOF
411 test_expect_success 'verify untracked cache dump' '
412 test-tool dump-untracked-cache >../actual &&
413 cat >../expect <<EOF &&
404 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
405 -core.excludesfile 0000000000000000000000000000000000000000
414 +info/exclude $(test_oid exclude)
415 +core.excludesfile $ZERO_OID
416 exclude_per_dir .gitignore
417 flags 00000006
408 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
418 +/ $(test_oid root) recurse valid
419 .gitignore
420 dtwo/
411 -/done/ 0000000000000000000000000000000000000000 recurse valid
412 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
413 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
421 +/done/ $ZERO_OID recurse valid
422 +/dthree/ $ZERO_OID recurse check_only valid
423 +/dtwo/ $ZERO_OID recurse check_only valid
424 two
425 EOF
426 test_cmp ../expect ../actual
@@ -447,16 +457,16 @@ EOF
457 test_expect_success 'untracked cache correct after commit' '
458 test-tool dump-untracked-cache >../actual &&
459 cat >../expect <<EOF &&
450 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
451 -core.excludesfile 0000000000000000000000000000000000000000
460 +info/exclude $(test_oid exclude)
461 +core.excludesfile $ZERO_OID
462 exclude_per_dir .gitignore
463 flags 00000006
454 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
464 +/ $(test_oid root) recurse valid
465 .gitignore
466 dtwo/
457 -/done/ 0000000000000000000000000000000000000000 recurse valid
458 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
459 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
467 +/done/ $ZERO_OID recurse valid
468 +/dthree/ $ZERO_OID recurse check_only valid
469 +/dtwo/ $ZERO_OID recurse check_only valid
470 two
471 EOF
472 test_cmp ../expect ../actual
@@ -508,17 +518,17 @@ EOF
518 test_expect_success 'untracked cache correct after status' '
519 test-tool dump-untracked-cache >../actual &&
520 cat >../expect <<EOF &&
511 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
512 -core.excludesfile 0000000000000000000000000000000000000000
521 +info/exclude $(test_oid exclude)
522 +core.excludesfile $ZERO_OID
523 exclude_per_dir .gitignore
524 flags 00000006
515 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
525 +/ $(test_oid root) recurse valid
526 .gitignore
527 dtwo/
518 -/done/ 1946f0437f90c5005533cbe1736a6451ca301714 recurse valid
528 +/done/ $(test_oid done) recurse valid
529 five
520 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
521 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
530 +/dthree/ $ZERO_OID recurse check_only valid
531 +/dtwo/ $ZERO_OID recurse check_only valid
532 two
533 EOF
534 test_cmp ../expect ../actual
@@ -580,22 +590,22 @@ EOF
590 test_expect_success 'verify untracked cache dump (sparse/subdirs)' '
591 test-tool dump-untracked-cache >../actual &&
592 cat >../expect-from-test-dump <<EOF &&
583 -info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
584 -core.excludesfile 0000000000000000000000000000000000000000
593 +info/exclude $(test_oid exclude)
594 +core.excludesfile $ZERO_OID
595 exclude_per_dir .gitignore
596 flags 00000006
587 -/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid
597 +/ $(test_oid root) recurse valid
598 .gitignore
599 dtwo/
590 -/done/ 1946f0437f90c5005533cbe1736a6451ca301714 recurse valid
600 +/done/ $(test_oid done) recurse valid
601 five
602 sub/
593 -/done/sub/ 0000000000000000000000000000000000000000 recurse check_only valid
603 +/done/sub/ $ZERO_OID recurse check_only valid
604 sub/
595 -/done/sub/sub/ 0000000000000000000000000000000000000000 recurse check_only valid
605 +/done/sub/sub/ $ZERO_OID recurse check_only valid
606 file
597 -/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid
598 -/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
607 +/dthree/ $ZERO_OID recurse check_only valid
608 +/dtwo/ $ZERO_OID recurse check_only valid
609 two
610 EOF
611 test_cmp ../expect-from-test-dump ../actual
@@ -806,8 +816,8 @@ test_expect_success '"status" after file replacement should be clean with UC=tru
816 test-tool dump-untracked-cache >../actual &&
817 grep -F "recurse valid" ../actual >../actual.grep &&
818 cat >../expect.grep <<EOF &&
809 -/ 0000000000000000000000000000000000000000 recurse valid
810 -/two/ 0000000000000000000000000000000000000000 recurse valid
819 +/ $ZERO_OID recurse valid
820 +/two/ $ZERO_OID recurse valid
821 EOF
822 status_is_clean &&
823 test_cmp ../expect.grep ../actual.grep