Skip to content

Commit 06ccb29

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 1c85474 commit 06ccb29

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,10 @@ TEST_BUILTINS_OBJS += test-ctype.o
658658
TEST_BUILTINS_OBJS += test-date.o
659659
TEST_BUILTINS_OBJS += test-delta.o
660660
TEST_BUILTINS_OBJS += test-drop-caches.o
661+
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
661662
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
662663
TEST_BUILTINS_OBJS += test-sha1.o
663664

664-
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
665665
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
666666
TEST_PROGRAMS_NEED_X += test-dump-split-index
667667
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache

t/helper/test-dump-cache-tree.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 "tree.h"
34
#include "cache-tree.h"
@@ -54,7 +55,7 @@ static int dump_cache_tree(struct cache_tree *it,
5455
return errs;
5556
}
5657

57-
int cmd_main(int ac, const char **av)
58+
int cmd__dump_cache_tree(int ac, const char **av)
5859
{
5960
struct index_state istate;
6061
struct cache_tree *another = cache_tree();

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ static struct test_cmd cmds[] = {
1313
{ "date", cmd__date },
1414
{ "delta", cmd__delta },
1515
{ "drop-caches", cmd__drop_caches },
16+
{ "dump-cache-tree", cmd__dump_cache_tree },
1617
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
1718
{ "sha1", cmd__sha1 },
1819
};

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ int cmd__ctype(int argc, const char **argv);
77
int cmd__date(int argc, const char **argv);
88
int cmd__delta(int argc, const char **argv);
99
int cmd__drop_caches(int argc, const char **argv);
10+
int cmd__dump_cache_tree(int argc, const char **argv);
1011
int cmd__lazy_init_name_hash(int argc, const char **argv);
1112
int cmd__sha1(int argc, const char **argv);
1213

t/t0090-cache-tree.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ cache-tree extension.
88
. ./test-lib.sh
99

1010
cmp_cache_tree () {
11-
test-dump-cache-tree | sed -e '/#(ref)/d' >actual &&
11+
test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
1212
sed "s/$_x40/SHA/" <actual >filtered &&
1313
test_cmp "$1" filtered
1414
}
1515

1616
# 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
1818
# correct.
1919
generate_expected_cache_tree_rec () {
2020
dir="$1${1:+/}" &&
@@ -47,7 +47,7 @@ test_cache_tree () {
4747

4848
test_invalid_cache_tree () {
4949
printf "invalid %s ()\n" "" "$@" >expect &&
50-
test-dump-cache-tree |
50+
test-tool dump-cache-tree |
5151
sed -n -e "s/[0-9]* subtrees//" -e '/#(ref)/d' -e '/^invalid /p' >actual &&
5252
test_cmp expect actual
5353
}

t/t1700-split-index.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
435435
commit=$(git commit-tree $tree -p HEAD <msg) &&
436436
git update-ref HEAD "$commit" &&
437437
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) &&
439439
test_line_count = 0 cache-tree.out
440440
'
441441

0 commit comments

Comments
 (0)