Skip to content

Commit cd780f0

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-dump-untracked-cache into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a0fe6e6 commit cd780f0

File tree

6 files changed

+41
-38
lines changed

6 files changed

+41
-38
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ TEST_BUILTINS_OBJS += test-delta.o
710710
TEST_BUILTINS_OBJS += test-drop-caches.o
711711
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
712712
TEST_BUILTINS_OBJS += test-dump-split-index.o
713+
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
713714
TEST_BUILTINS_OBJS += test-example-decorate.o
714715
TEST_BUILTINS_OBJS += test-genrandom.o
715716
TEST_BUILTINS_OBJS += test-hashmap.o
@@ -741,7 +742,6 @@ TEST_BUILTINS_OBJS += test-wildmatch.o
741742
TEST_BUILTINS_OBJS += test-write-cache.o
742743

743744
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
744-
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
745745
TEST_PROGRAMS_NEED_X += test-fake-ssh
746746
TEST_PROGRAMS_NEED_X += test-line-buffer
747747
TEST_PROGRAMS_NEED_X += test-parse-options

t/helper/test-dump-untracked-cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23
#include "dir.h"
34

@@ -38,7 +39,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
3839
strbuf_setlen(base, len);
3940
}
4041

41-
int cmd_main(int ac, const char **av)
42+
int cmd__dump_untracked_cache(int ac, const char **av)
4243
{
4344
struct untracked_cache *uc;
4445
struct strbuf base = STRBUF_INIT;

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static struct test_cmd cmds[] = {
1515
{ "drop-caches", cmd__drop_caches },
1616
{ "dump-cache-tree", cmd__dump_cache_tree },
1717
{ "dump-split-index", cmd__dump_split_index },
18+
{ "dump-untracked-cache", cmd__dump_untracked_cache },
1819
{ "example-decorate", cmd__example_decorate },
1920
{ "genrandom", cmd__genrandom },
2021
{ "hashmap", cmd__hashmap },

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ int cmd__delta(int argc, const char **argv);
1111
int cmd__drop_caches(int argc, const char **argv);
1212
int cmd__dump_cache_tree(int argc, const char **argv);
1313
int cmd__dump_split_index(int argc, const char **argv);
14+
int cmd__dump_untracked_cache(int argc, const char **argv);
1415
int cmd__example_decorate(int argc, const char **argv);
1516
int cmd__genrandom(int argc, const char **argv);
1617
int cmd__hashmap(int argc, const char **argv);

t/t7063-status-untracked-cache.sh

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ test_expect_success 'setup' '
5555
'
5656

5757
test_expect_success 'untracked cache is empty' '
58-
test-dump-untracked-cache >../actual &&
58+
test-tool dump-untracked-cache >../actual &&
5959
cat >../expect-empty <<EOF &&
6060
info/exclude 0000000000000000000000000000000000000000
6161
core.excludesfile 0000000000000000000000000000000000000000
@@ -106,7 +106,7 @@ EOF
106106
'
107107

108108
test_expect_success 'untracked cache after first status' '
109-
test-dump-untracked-cache >../actual &&
109+
test-tool dump-untracked-cache >../actual &&
110110
test_cmp ../dump.expect ../actual
111111
'
112112

@@ -126,7 +126,7 @@ EOF
126126
'
127127

128128
test_expect_success 'untracked cache after second status' '
129-
test-dump-untracked-cache >../actual &&
129+
test-tool dump-untracked-cache >../actual &&
130130
test_cmp ../dump.expect ../actual
131131
'
132132

@@ -157,7 +157,7 @@ EOF
157157
'
158158

159159
test_expect_success 'verify untracked cache dump' '
160-
test-dump-untracked-cache >../actual &&
160+
test-tool dump-untracked-cache >../actual &&
161161
cat >../expect <<EOF &&
162162
info/exclude $EMPTY_BLOB
163163
core.excludesfile 0000000000000000000000000000000000000000
@@ -204,7 +204,7 @@ EOF
204204
'
205205

206206
test_expect_success 'verify untracked cache dump' '
207-
test-dump-untracked-cache >../actual &&
207+
test-tool dump-untracked-cache >../actual &&
208208
cat >../expect <<EOF &&
209209
info/exclude $EMPTY_BLOB
210210
core.excludesfile 0000000000000000000000000000000000000000
@@ -248,7 +248,7 @@ EOF
248248
'
249249

250250
test_expect_success 'verify untracked cache dump' '
251-
test-dump-untracked-cache >../actual &&
251+
test-tool dump-untracked-cache >../actual &&
252252
cat >../expect <<EOF &&
253253
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
254254
core.excludesfile 0000000000000000000000000000000000000000
@@ -267,7 +267,7 @@ EOF
267267

268268
test_expect_success 'move two from tracked to untracked' '
269269
git rm --cached two &&
270-
test-dump-untracked-cache >../actual &&
270+
test-tool dump-untracked-cache >../actual &&
271271
cat >../expect <<EOF &&
272272
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
273273
core.excludesfile 0000000000000000000000000000000000000000
@@ -304,7 +304,7 @@ EOF
304304
'
305305

306306
test_expect_success 'verify untracked cache dump' '
307-
test-dump-untracked-cache >../actual &&
307+
test-tool dump-untracked-cache >../actual &&
308308
cat >../expect <<EOF &&
309309
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
310310
core.excludesfile 0000000000000000000000000000000000000000
@@ -324,7 +324,7 @@ EOF
324324

325325
test_expect_success 'move two from untracked to tracked' '
326326
git add two &&
327-
test-dump-untracked-cache >../actual &&
327+
test-tool dump-untracked-cache >../actual &&
328328
cat >../expect <<EOF &&
329329
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
330330
core.excludesfile 0000000000000000000000000000000000000000
@@ -361,7 +361,7 @@ EOF
361361
'
362362

363363
test_expect_success 'verify untracked cache dump' '
364-
test-dump-untracked-cache >../actual &&
364+
test-tool dump-untracked-cache >../actual &&
365365
cat >../expect <<EOF &&
366366
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
367367
core.excludesfile 0000000000000000000000000000000000000000
@@ -405,7 +405,7 @@ EOF
405405
'
406406

407407
test_expect_success 'untracked cache correct after commit' '
408-
test-dump-untracked-cache >../actual &&
408+
test-tool dump-untracked-cache >../actual &&
409409
cat >../expect <<EOF &&
410410
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
411411
core.excludesfile 0000000000000000000000000000000000000000
@@ -464,7 +464,7 @@ EOF
464464
'
465465

466466
test_expect_success 'untracked cache correct after status' '
467-
test-dump-untracked-cache >../actual &&
467+
test-tool dump-untracked-cache >../actual &&
468468
cat >../expect <<EOF &&
469469
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
470470
core.excludesfile 0000000000000000000000000000000000000000
@@ -532,7 +532,7 @@ EOF
532532
'
533533

534534
test_expect_success 'verify untracked cache dump (sparse/subdirs)' '
535-
test-dump-untracked-cache >../actual &&
535+
test-tool dump-untracked-cache >../actual &&
536536
cat >../expect-from-test-dump <<EOF &&
537537
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
538538
core.excludesfile 0000000000000000000000000000000000000000
@@ -598,66 +598,66 @@ EOF
598598

599599
test_expect_success '--no-untracked-cache removes the cache' '
600600
git update-index --no-untracked-cache &&
601-
test-dump-untracked-cache >../actual &&
601+
test-tool dump-untracked-cache >../actual &&
602602
echo "no untracked cache" >../expect-no-uc &&
603603
test_cmp ../expect-no-uc ../actual
604604
'
605605

606606
test_expect_success 'git status does not change anything' '
607607
git status &&
608-
test-dump-untracked-cache >../actual &&
608+
test-tool dump-untracked-cache >../actual &&
609609
test_cmp ../expect-no-uc ../actual
610610
'
611611

612612
test_expect_success 'setting core.untrackedCache to true and using git status creates the cache' '
613613
git config core.untrackedCache true &&
614-
test-dump-untracked-cache >../actual &&
614+
test-tool dump-untracked-cache >../actual &&
615615
test_cmp ../expect-no-uc ../actual &&
616616
git status &&
617-
test-dump-untracked-cache >../actual &&
617+
test-tool dump-untracked-cache >../actual &&
618618
test_cmp ../expect-from-test-dump ../actual
619619
'
620620

621621
test_expect_success 'using --no-untracked-cache does not fail when core.untrackedCache is true' '
622622
git update-index --no-untracked-cache &&
623-
test-dump-untracked-cache >../actual &&
623+
test-tool dump-untracked-cache >../actual &&
624624
test_cmp ../expect-no-uc ../actual &&
625625
git update-index --untracked-cache &&
626-
test-dump-untracked-cache >../actual &&
626+
test-tool dump-untracked-cache >../actual &&
627627
test_cmp ../expect-empty ../actual
628628
'
629629

630630
test_expect_success 'setting core.untrackedCache to false and using git status removes the cache' '
631631
git config core.untrackedCache false &&
632-
test-dump-untracked-cache >../actual &&
632+
test-tool dump-untracked-cache >../actual &&
633633
test_cmp ../expect-empty ../actual &&
634634
git status &&
635-
test-dump-untracked-cache >../actual &&
635+
test-tool dump-untracked-cache >../actual &&
636636
test_cmp ../expect-no-uc ../actual
637637
'
638638

639639
test_expect_success 'using --untracked-cache does not fail when core.untrackedCache is false' '
640640
git update-index --untracked-cache &&
641-
test-dump-untracked-cache >../actual &&
641+
test-tool dump-untracked-cache >../actual &&
642642
test_cmp ../expect-empty ../actual
643643
'
644644

645645
test_expect_success 'setting core.untrackedCache to keep' '
646646
git config core.untrackedCache keep &&
647647
git update-index --untracked-cache &&
648-
test-dump-untracked-cache >../actual &&
648+
test-tool dump-untracked-cache >../actual &&
649649
test_cmp ../expect-empty ../actual &&
650650
git status &&
651-
test-dump-untracked-cache >../actual &&
651+
test-tool dump-untracked-cache >../actual &&
652652
test_cmp ../expect-from-test-dump ../actual &&
653653
git update-index --no-untracked-cache &&
654-
test-dump-untracked-cache >../actual &&
654+
test-tool dump-untracked-cache >../actual &&
655655
test_cmp ../expect-no-uc ../actual &&
656656
git update-index --force-untracked-cache &&
657-
test-dump-untracked-cache >../actual &&
657+
test-tool dump-untracked-cache >../actual &&
658658
test_cmp ../expect-empty ../actual &&
659659
git status &&
660-
test-dump-untracked-cache >../actual &&
660+
test-tool dump-untracked-cache >../actual &&
661661
test_cmp ../expect-from-test-dump ../actual
662662
'
663663

@@ -671,23 +671,23 @@ test_expect_success 'test ident field is working' '
671671

672672
test_expect_success 'untracked cache survives a checkout' '
673673
git commit --allow-empty -m empty &&
674-
test-dump-untracked-cache >../before &&
674+
test-tool dump-untracked-cache >../before &&
675675
test_when_finished "git checkout master" &&
676676
git checkout -b other_branch &&
677-
test-dump-untracked-cache >../after &&
677+
test-tool dump-untracked-cache >../after &&
678678
test_cmp ../before ../after &&
679679
test_commit test &&
680-
test-dump-untracked-cache >../before &&
680+
test-tool dump-untracked-cache >../before &&
681681
git checkout master &&
682-
test-dump-untracked-cache >../after &&
682+
test-tool dump-untracked-cache >../after &&
683683
test_cmp ../before ../after
684684
'
685685

686686
test_expect_success 'untracked cache survives a commit' '
687-
test-dump-untracked-cache >../before &&
687+
test-tool dump-untracked-cache >../before &&
688688
git add done/two &&
689689
git commit -m commit &&
690-
test-dump-untracked-cache >../after &&
690+
test-tool dump-untracked-cache >../after &&
691691
test_cmp ../before ../after
692692
'
693693

@@ -751,7 +751,7 @@ test_expect_success '"status" after file replacement should be clean with UC=tru
751751
git checkout master &&
752752
avoid_racy &&
753753
status_is_clean &&
754-
test-dump-untracked-cache >../actual &&
754+
test-tool dump-untracked-cache >../actual &&
755755
grep -F "recurse valid" ../actual >../actual.grep &&
756756
cat >../expect.grep <<EOF &&
757757
/ 0000000000000000000000000000000000000000 recurse valid

t/t7519-status-fsmonitor.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
333333
git update-index --fsmonitor &&
334334
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-before" \
335335
git status &&
336-
test-dump-untracked-cache >../before
336+
test-tool dump-untracked-cache >../before
337337
) &&
338338
cat >>dot-git/.git/hooks/fsmonitor-test <<-\EOF &&
339339
printf ".git\0"
@@ -345,7 +345,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
345345
cd dot-git &&
346346
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-after" \
347347
git status &&
348-
test-dump-untracked-cache >../after
348+
test-tool dump-untracked-cache >../after
349349
) &&
350350
grep "directory invalidation" trace-before >>before &&
351351
grep "directory invalidation" trace-after >>after &&

0 commit comments

Comments
 (0)