@@ -18,6 +18,10 @@ if ! test_have_prereq UNTRACKED_CACHE; then
18
18
test_done
19
19
fi
20
20
21
+ test_expect_success ' core.untrackedCache is unset' '
22
+ test_must_fail git config --get core.untrackedCache
23
+ '
24
+
21
25
test_expect_success ' setup' '
22
26
git init worktree &&
23
27
cd worktree &&
@@ -30,13 +34,13 @@ test_expect_success 'setup' '
30
34
31
35
test_expect_success ' untracked cache is empty' '
32
36
test-dump-untracked-cache >../actual &&
33
- cat >../expect <<EOF &&
37
+ cat >../expect-empty <<EOF &&
34
38
info/exclude 0000000000000000000000000000000000000000
35
39
core.excludesfile 0000000000000000000000000000000000000000
36
40
exclude_per_dir .gitignore
37
41
flags 00000006
38
42
EOF
39
- test_cmp ../expect ../actual
43
+ test_cmp ../expect-empty ../actual
40
44
'
41
45
42
46
cat > ../status.expect << EOF &&
506
510
507
511
test_expect_success ' verify untracked cache dump (sparse/subdirs)' '
508
512
test-dump-untracked-cache >../actual &&
509
- cat >../expect <<EOF &&
513
+ cat >../expect-from-test-dump <<EOF &&
510
514
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
511
515
core.excludesfile 0000000000000000000000000000000000000000
512
516
exclude_per_dir .gitignore
525
529
/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid
526
530
two
527
531
EOF
528
- test_cmp ../expect ../actual
532
+ test_cmp ../expect-from-test-dump ../actual
529
533
'
530
534
531
535
test_expect_success ' test sparse status again with untracked cache and subdir' '
569
573
test_cmp ../status.expect ../status.actual
570
574
'
571
575
576
+ test_expect_success ' --no-untracked-cache removes the cache' '
577
+ git update-index --no-untracked-cache &&
578
+ test-dump-untracked-cache >../actual &&
579
+ echo "no untracked cache" >../expect-no-uc &&
580
+ test_cmp ../expect-no-uc ../actual
581
+ '
582
+
583
+ test_expect_success ' git status does not change anything' '
584
+ git status &&
585
+ test-dump-untracked-cache >../actual &&
586
+ test_cmp ../expect-no-uc ../actual
587
+ '
588
+
589
+ test_expect_success ' setting core.untrackedCache to true and using git status creates the cache' '
590
+ git config core.untrackedCache true &&
591
+ test-dump-untracked-cache >../actual &&
592
+ test_cmp ../expect-no-uc ../actual &&
593
+ git status &&
594
+ test-dump-untracked-cache >../actual &&
595
+ test_cmp ../expect-from-test-dump ../actual
596
+ '
597
+
598
+ test_expect_success ' using --no-untracked-cache does not fail when core.untrackedCache is true' '
599
+ git update-index --no-untracked-cache &&
600
+ test-dump-untracked-cache >../actual &&
601
+ test_cmp ../expect-no-uc ../actual &&
602
+ git update-index --untracked-cache &&
603
+ test-dump-untracked-cache >../actual &&
604
+ test_cmp ../expect-empty ../actual
605
+ '
606
+
607
+ test_expect_success ' setting core.untrackedCache to false and using git status removes the cache' '
608
+ git config core.untrackedCache false &&
609
+ test-dump-untracked-cache >../actual &&
610
+ test_cmp ../expect-empty ../actual &&
611
+ git status &&
612
+ test-dump-untracked-cache >../actual &&
613
+ test_cmp ../expect-no-uc ../actual
614
+ '
615
+
616
+ test_expect_success ' using --untracked-cache does not fail when core.untrackedCache is false' '
617
+ git update-index --untracked-cache &&
618
+ test-dump-untracked-cache >../actual &&
619
+ test_cmp ../expect-empty ../actual
620
+ '
621
+
622
+ test_expect_success ' setting core.untrackedCache to keep' '
623
+ git config core.untrackedCache keep &&
624
+ git update-index --untracked-cache &&
625
+ test-dump-untracked-cache >../actual &&
626
+ test_cmp ../expect-empty ../actual &&
627
+ git status &&
628
+ test-dump-untracked-cache >../actual &&
629
+ test_cmp ../expect-from-test-dump ../actual &&
630
+ git update-index --no-untracked-cache &&
631
+ test-dump-untracked-cache >../actual &&
632
+ test_cmp ../expect-no-uc ../actual &&
633
+ git update-index --force-untracked-cache &&
634
+ test-dump-untracked-cache >../actual &&
635
+ test_cmp ../expect-empty ../actual &&
636
+ git status &&
637
+ test-dump-untracked-cache >../actual &&
638
+ test_cmp ../expect-from-test-dump ../actual
639
+ '
640
+
641
+ test_expect_success ' test ident field is working' '
642
+ mkdir ../other_worktree &&
643
+ cp -R done dthree dtwo four three ../other_worktree &&
644
+ GIT_WORK_TREE=../other_worktree git status 2>../err &&
645
+ echo "warning: Untracked cache is disabled on this system or location." >../expect &&
646
+ test_cmp ../expect ../err
647
+ '
648
+
572
649
test_done
0 commit comments