t/helper: merge test-dump-cache-tree into test-tool

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 24, 2018 at 08:44 UTC 06ccb29e8b904dd786ff740a412b634815777249
6 files changed +9 -6
Makefile
+1 -1
@@ -658,10 +658,10 @@ TEST_BUILTINS_OBJS += test-ctype.o
658 TEST_BUILTINS_OBJS += test-date.o
659 TEST_BUILTINS_OBJS += test-delta.o
660 TEST_BUILTINS_OBJS += test-drop-caches.o
661 +TEST_BUILTINS_OBJS += test-dump-cache-tree.o
662 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
663 TEST_BUILTINS_OBJS += test-sha1.o
664
664 -TEST_PROGRAMS_NEED_X += test-dump-cache-tree
665 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
666 TEST_PROGRAMS_NEED_X += test-dump-split-index
667 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
t/helper/test-dump-cache-tree.c
+2 -1
@@ -1,3 +1,4 @@
1 +#include "test-tool.h"
2 #include "cache.h"
3 #include "tree.h"
4 #include "cache-tree.h"
@@ -54,7 +55,7 @@ static int dump_cache_tree(struct cache_tree *it,
55 return errs;
56 }
57
57 -int cmd_main(int ac, const char **av)
58 +int cmd__dump_cache_tree(int ac, const char **av)
59 {
60 struct index_state istate;
61 struct cache_tree *another = cache_tree();
t/helper/test-tool.c
+1
@@ -13,6 +13,7 @@ static struct test_cmd cmds[] = {
13 { "date", cmd__date },
14 { "delta", cmd__delta },
15 { "drop-caches", cmd__drop_caches },
16 + { "dump-cache-tree", cmd__dump_cache_tree },
17 { "lazy-init-name-hash", cmd__lazy_init_name_hash },
18 { "sha1", cmd__sha1 },
19 };
t/helper/test-tool.h
+1
@@ -7,6 +7,7 @@ int cmd__ctype(int argc, const char **argv);
7 int cmd__date(int argc, const char **argv);
8 int cmd__delta(int argc, const char **argv);
9 int cmd__drop_caches(int argc, const char **argv);
10 +int cmd__dump_cache_tree(int argc, const char **argv);
11 int cmd__lazy_init_name_hash(int argc, const char **argv);
12 int cmd__sha1(int argc, const char **argv);
13
t/t0090-cache-tree.sh
+3 -3
@@ -8,13 +8,13 @@ cache-tree extension.
8 . ./test-lib.sh
9
10 cmp_cache_tree () {
11 - test-dump-cache-tree | sed -e '/#(ref)/d' >actual &&
11 + test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
12 sed "s/$_x40/SHA/" <actual >filtered &&
13 test_cmp "$1" filtered
14 }
15
16 # We don't bother with actually checking the SHA1:
17 -# test-dump-cache-tree already verifies that all existing data is
17 +# test-tool dump-cache-tree already verifies that all existing data is
18 # correct.
19 generate_expected_cache_tree_rec () {
20 dir="$1${1:+/}" &&
@@ -47,7 +47,7 @@ test_cache_tree () {
47
48 test_invalid_cache_tree () {
49 printf "invalid %s ()\n" "" "$@" >expect &&
50 - test-dump-cache-tree |
50 + test-tool dump-cache-tree |
51 sed -n -e "s/[0-9]* subtrees//" -e '/#(ref)/d' -e '/^invalid /p' >actual &&
52 test_cmp expect actual
53 }
t/t1700-split-index.sh
+1 -1
@@ -435,7 +435,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
435 commit=$(git commit-tree $tree -p HEAD <msg) &&
436 git update-ref HEAD "$commit" &&
437 GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
438 - (test-dump-cache-tree >cache-tree.out || true) &&
438 + (test-tool dump-cache-tree >cache-tree.out || true) &&
439 test_line_count = 0 cache-tree.out
440 '
441