t/helper: merge test-index-version 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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2018-03-24 08:44:44 +01:00 committed by Junio C Hamano
parent 7c18cbd562
commit cc6f663dea
7 changed files with 10 additions and 7 deletions

View File

@ -663,13 +663,13 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
TEST_BUILTINS_OBJS += test-example-decorate.o TEST_BUILTINS_OBJS += test-example-decorate.o
TEST_BUILTINS_OBJS += test-genrandom.o TEST_BUILTINS_OBJS += test-genrandom.o
TEST_BUILTINS_OBJS += test-hashmap.o TEST_BUILTINS_OBJS += test-hashmap.o
TEST_BUILTINS_OBJS += test-index-version.o
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
TEST_BUILTINS_OBJS += test-sha1.o TEST_BUILTINS_OBJS += test-sha1.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
TEST_PROGRAMS_NEED_X += test-fake-ssh TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-index-version
TEST_PROGRAMS_NEED_X += test-line-buffer TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-match-trees TEST_PROGRAMS_NEED_X += test-match-trees
TEST_PROGRAMS_NEED_X += test-mergesort TEST_PROGRAMS_NEED_X += test-mergesort

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h" #include "cache.h"
int cmd_main(int argc, const char **argv) int cmd__index_version(int argc, const char **argv)
{ {
struct cache_header hdr; struct cache_header hdr;
int version; int version;

View File

@ -18,6 +18,7 @@ static struct test_cmd cmds[] = {
{ "example-decorate", cmd__example_decorate }, { "example-decorate", cmd__example_decorate },
{ "genrandom", cmd__genrandom }, { "genrandom", cmd__genrandom },
{ "hashmap", cmd__hashmap }, { "hashmap", cmd__hashmap },
{ "index-version", cmd__index_version },
{ "lazy-init-name-hash", cmd__lazy_init_name_hash }, { "lazy-init-name-hash", cmd__lazy_init_name_hash },
{ "sha1", cmd__sha1 }, { "sha1", cmd__sha1 },
}; };

View File

@ -12,6 +12,7 @@ int cmd__dump_split_index(int argc, const char **argv);
int cmd__example_decorate(int argc, const char **argv); int cmd__example_decorate(int argc, const char **argv);
int cmd__genrandom(int argc, const char **argv); int cmd__genrandom(int argc, const char **argv);
int cmd__hashmap(int argc, const char **argv); int cmd__hashmap(int argc, const char **argv);
int cmd__index_version(int argc, const char **argv);
int cmd__lazy_init_name_hash(int argc, const char **argv); int cmd__lazy_init_name_hash(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv); int cmd__sha1(int argc, const char **argv);

View File

@ -68,7 +68,7 @@ test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
git config --add index.version 2 && git config --add index.version 2 &&
git add a 2>&1 && git add a 2>&1 &&
echo 4 >expect && echo 4 >expect &&
test-index-version <.git/index >actual && test-tool index-version <.git/index >actual &&
test_cmp expect actual test_cmp expect actual
) )
' '

View File

@ -12,7 +12,7 @@ test_expect_success 'enable split index' '
git config splitIndex.maxPercentChange 100 && git config splitIndex.maxPercentChange 100 &&
git update-index --split-index && git update-index --split-index &&
test-tool dump-split-index .git/index >actual && test-tool dump-split-index .git/index >actual &&
indexversion=$(test-index-version <.git/index) && indexversion=$(test-tool index-version <.git/index) &&
if test "$indexversion" = "4" if test "$indexversion" = "4"
then then
own=432ef4b63f32193984f339431fd50ca796493569 own=432ef4b63f32193984f339431fd50ca796493569

View File

@ -33,7 +33,7 @@ test_expect_success 'setup' '
' '
test_expect_success 'index is at version 2' ' test_expect_success 'index is at version 2' '
test "$(test-index-version < .git/index)" = 2 test "$(test-tool index-version < .git/index)" = 2
' '
test_expect_success 'update-index --skip-worktree' ' test_expect_success 'update-index --skip-worktree' '
@ -42,7 +42,7 @@ test_expect_success 'update-index --skip-worktree' '
' '
test_expect_success 'index is at version 3 after having some skip-worktree entries' ' test_expect_success 'index is at version 3 after having some skip-worktree entries' '
test "$(test-index-version < .git/index)" = 3 test "$(test-tool index-version < .git/index)" = 3
' '
test_expect_success 'ls-files -t' ' test_expect_success 'ls-files -t' '
@ -55,7 +55,7 @@ test_expect_success 'update-index --no-skip-worktree' '
' '
test_expect_success 'index version is back to 2 when there is no skip-worktree entry' ' test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
test "$(test-index-version < .git/index)" = 2 test "$(test-tool index-version < .git/index)" = 2
' '
test_done test_done