@@ -30,6 +30,30 @@ status_is_clean() {
30
30
test_must_be_empty ../status.actual
31
31
}
32
32
33
+ # Ignore_Untracked_Cache, abbreviated to 3 letters because then people can
34
+ # compare commands side-by-side, e.g.
35
+ # iuc status --porcelain >expect &&
36
+ # git status --porcelain >actual &&
37
+ # test_cmp expect actual
38
+ iuc () {
39
+ git ls-files -s > ../current-index-entries
40
+ git ls-files -t | sed -ne s/^S.//p > ../current-sparse-entries
41
+
42
+ GIT_INDEX_FILE=.git/tmp_index
43
+ export GIT_INDEX_FILE
44
+ git update-index --index-info < ../current-index-entries
45
+ git update-index --skip-worktree $( cat ../current-sparse-entries)
46
+
47
+ git -c core.untrackedCache=false " $@ "
48
+ ret=$?
49
+
50
+ rm ../current-index-entries
51
+ rm $GIT_INDEX_FILE
52
+ unset GIT_INDEX_FILE
53
+
54
+ return $ret
55
+ }
56
+
33
57
test_lazy_prereq UNTRACKED_CACHE '
34
58
{ git update-index --test-untracked-cache; ret=$?; } &&
35
59
test $ret -ne 1
@@ -95,6 +119,8 @@ test_expect_success 'status first time (empty cache)' '
95
119
: >../trace &&
96
120
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
97
121
git status --porcelain >../actual &&
122
+ iuc status --porcelain >../status.iuc &&
123
+ test_cmp ../status.expect ../status.iuc &&
98
124
test_cmp ../status.expect ../actual &&
99
125
cat >../trace.expect <<EOF &&
100
126
node creation: 3
@@ -115,6 +141,8 @@ test_expect_success 'status second time (fully populated cache)' '
115
141
: >../trace &&
116
142
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
117
143
git status --porcelain >../actual &&
144
+ iuc status --porcelain >../status.iuc &&
145
+ test_cmp ../status.expect ../status.iuc &&
118
146
test_cmp ../status.expect ../actual &&
119
147
cat >../trace.expect <<EOF &&
120
148
node creation: 0
@@ -136,6 +164,7 @@ test_expect_success 'modify in root directory, one dir invalidation' '
136
164
: >../trace &&
137
165
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
138
166
git status --porcelain >../actual &&
167
+ iuc status --porcelain >../status.iuc &&
139
168
cat >../status.expect <<EOF &&
140
169
A done/one
141
170
A one
@@ -145,6 +174,7 @@ A two
145
174
?? four
146
175
?? three
147
176
EOF
177
+ test_cmp ../status.expect ../status.iuc &&
148
178
test_cmp ../status.expect ../actual &&
149
179
cat >../trace.expect <<EOF &&
150
180
node creation: 0
@@ -183,6 +213,7 @@ test_expect_success 'new .gitignore invalidates recursively' '
183
213
: >../trace &&
184
214
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
185
215
git status --porcelain >../actual &&
216
+ iuc status --porcelain >../status.iuc &&
186
217
cat >../status.expect <<EOF &&
187
218
A done/one
188
219
A one
@@ -192,6 +223,7 @@ A two
192
223
?? dtwo/
193
224
?? three
194
225
EOF
226
+ test_cmp ../status.expect ../status.iuc &&
195
227
test_cmp ../status.expect ../actual &&
196
228
cat >../trace.expect <<EOF &&
197
229
node creation: 0
@@ -230,13 +262,15 @@ test_expect_success 'new info/exclude invalidates everything' '
230
262
: >../trace &&
231
263
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
232
264
git status --porcelain >../actual &&
265
+ iuc status --porcelain >../status.iuc &&
233
266
cat >../status.expect <<EOF &&
234
267
A done/one
235
268
A one
236
269
A two
237
270
?? .gitignore
238
271
?? dtwo/
239
272
EOF
273
+ test_cmp ../status.expect ../status.iuc &&
240
274
test_cmp ../status.expect ../actual &&
241
275
cat >../trace.expect <<EOF &&
242
276
node creation: 0
@@ -286,13 +320,15 @@ test_expect_success 'status after the move' '
286
320
: >../trace &&
287
321
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
288
322
git status --porcelain >../actual &&
323
+ iuc status --porcelain >../status.iuc &&
289
324
cat >../status.expect <<EOF &&
290
325
A done/one
291
326
A one
292
327
?? .gitignore
293
328
?? dtwo/
294
329
?? two
295
330
EOF
331
+ test_cmp ../status.expect ../status.iuc &&
296
332
test_cmp ../status.expect ../actual &&
297
333
cat >../trace.expect <<EOF &&
298
334
node creation: 0
@@ -343,13 +379,15 @@ test_expect_success 'status after the move' '
343
379
: >../trace &&
344
380
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
345
381
git status --porcelain >../actual &&
382
+ iuc status --porcelain >../status.iuc &&
346
383
cat >../status.expect <<EOF &&
347
384
A done/one
348
385
A one
349
386
A two
350
387
?? .gitignore
351
388
?? dtwo/
352
389
EOF
390
+ test_cmp ../status.expect ../status.iuc &&
353
391
test_cmp ../status.expect ../actual &&
354
392
cat >../trace.expect <<EOF &&
355
393
node creation: 0
@@ -390,10 +428,12 @@ test_expect_success 'status after commit' '
390
428
: >../trace &&
391
429
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
392
430
git status --porcelain >../actual &&
431
+ iuc status --porcelain >../status.iuc &&
393
432
cat >../status.expect <<EOF &&
394
433
?? .gitignore
395
434
?? dtwo/
396
435
EOF
436
+ test_cmp ../status.expect ../status.iuc &&
397
437
test_cmp ../status.expect ../actual &&
398
438
cat >../trace.expect <<EOF &&
399
439
node creation: 0
@@ -447,12 +487,14 @@ test_expect_success 'test sparse status with untracked cache' '
447
487
avoid_racy &&
448
488
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
449
489
git status --porcelain >../status.actual &&
490
+ iuc status --porcelain >../status.iuc &&
450
491
cat >../status.expect <<EOF &&
451
492
M done/two
452
493
?? .gitignore
453
494
?? done/five
454
495
?? dtwo/
455
496
EOF
497
+ test_cmp ../status.expect ../status.iuc &&
456
498
test_cmp ../status.expect ../status.actual &&
457
499
cat >../trace.expect <<EOF &&
458
500
node creation: 0
@@ -487,12 +529,14 @@ test_expect_success 'test sparse status again with untracked cache' '
487
529
: >../trace &&
488
530
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
489
531
git status --porcelain >../status.actual &&
532
+ iuc status --porcelain >../status.iuc &&
490
533
cat >../status.expect <<EOF &&
491
534
M done/two
492
535
?? .gitignore
493
536
?? done/five
494
537
?? dtwo/
495
538
EOF
539
+ test_cmp ../status.expect ../status.iuc &&
496
540
test_cmp ../status.expect ../status.actual &&
497
541
cat >../trace.expect <<EOF &&
498
542
node creation: 0
@@ -514,13 +558,15 @@ test_expect_success 'test sparse status with untracked cache and subdir' '
514
558
: >../trace &&
515
559
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
516
560
git status --porcelain >../status.actual &&
561
+ iuc status --porcelain >../status.iuc &&
517
562
cat >../status.expect <<EOF &&
518
563
M done/two
519
564
?? .gitignore
520
565
?? done/five
521
566
?? done/sub/
522
567
?? dtwo/
523
568
EOF
569
+ test_cmp ../status.expect ../status.iuc &&
524
570
test_cmp ../status.expect ../status.actual &&
525
571
cat >../trace.expect <<EOF &&
526
572
node creation: 2
@@ -560,6 +606,8 @@ test_expect_success 'test sparse status again with untracked cache and subdir' '
560
606
: >../trace &&
561
607
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
562
608
git status --porcelain >../status.actual &&
609
+ iuc status --porcelain >../status.iuc &&
610
+ test_cmp ../status.expect ../status.iuc &&
563
611
test_cmp ../status.expect ../status.actual &&
564
612
cat >../trace.expect <<EOF &&
565
613
node creation: 0
@@ -573,26 +621,30 @@ EOF
573
621
test_expect_success ' move entry in subdir from untracked to cached' '
574
622
git add dtwo/two &&
575
623
git status --porcelain >../status.actual &&
624
+ iuc status --porcelain >../status.iuc &&
576
625
cat >../status.expect <<EOF &&
577
626
M done/two
578
627
A dtwo/two
579
628
?? .gitignore
580
629
?? done/five
581
630
?? done/sub/
582
631
EOF
632
+ test_cmp ../status.expect ../status.iuc &&
583
633
test_cmp ../status.expect ../status.actual
584
634
'
585
635
586
636
test_expect_success ' move entry in subdir from cached to untracked' '
587
637
git rm --cached dtwo/two &&
588
638
git status --porcelain >../status.actual &&
639
+ iuc status --porcelain >../status.iuc &&
589
640
cat >../status.expect <<EOF &&
590
641
M done/two
591
642
?? .gitignore
592
643
?? done/five
593
644
?? done/sub/
594
645
?? dtwo/
595
646
EOF
647
+ test_cmp ../status.expect ../status.iuc &&
596
648
test_cmp ../status.expect ../status.actual
597
649
'
598
650
0 commit comments