t/helper: merge test-index-version into test-tool
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 24 Mar 2018 07:44:44 +0000 (08:44 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Mar 2018 15:45:47 +0000 (08:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/test-index-version.c
t/helper/test-tool.c
t/helper/test-tool.h
t/t1600-index.sh
t/t1700-split-index.sh
t/t2104-update-index-skip-worktree.sh
index f6c3ddc703bb797a19a3c10e465f648ad7c3adec..d7342e3a8bc92a1486d8bee6a9fde13b71a092cd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -663,13 +663,13 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
 TEST_BUILTINS_OBJS += test-example-decorate.o
 TEST_BUILTINS_OBJS += test-genrandom.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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 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-match-trees
 TEST_PROGRAMS_NEED_X += test-mergesort
index f569f6b7eff87227f82dbe6390fd31fb970a5fca..fcd10968cc10bdab8db146b8ba65080431e5ed24 100644 (file)
@@ -1,6 +1,7 @@
+#include "test-tool.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;
        int version;
index 81bafced8b0ddaf87d4f6f727561d9840aff91d5..d38d4ddc725aa9b0e9dfa2221f1eb47e0cafef75 100644 (file)
@@ -18,6 +18,7 @@ static struct test_cmd cmds[] = {
        { "example-decorate", cmd__example_decorate },
        { "genrandom", cmd__genrandom },
        { "hashmap", cmd__hashmap },
+       { "index-version", cmd__index_version },
        { "lazy-init-name-hash", cmd__lazy_init_name_hash },
        { "sha1", cmd__sha1 },
 };
index fba4bd80b9591fea9bf28b7f8997001495ff9ff7..b855203477fb5b9c3b764c4ba2e40e3919110b0d 100644 (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__genrandom(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__sha1(int argc, const char **argv);
 
index 079d2411450ca960d3d82fb9c7d59921c4cbe60a..c4422312f4e482e38172b1ac8b87e29d8708af2e 100755 (executable)
@@ -68,7 +68,7 @@ test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
                git config --add index.version 2 &&
                git add a 2>&1 &&
                echo 4 >expect &&
-               test-index-version <.git/index >actual &&
+               test-tool index-version <.git/index >actual &&
                test_cmp expect actual
        )
 '
index ec179fbaf76014973ec400d9259db640695fd82e..e4f4c4df4ee3686e5ad1621134a827b941b38bca 100755 (executable)
@@ -12,7 +12,7 @@ test_expect_success 'enable split index' '
        git config splitIndex.maxPercentChange 100 &&
        git update-index --split-index &&
        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"
        then
                own=432ef4b63f32193984f339431fd50ca796493569
index cc830da58d920718b7b0a990a359afa9dd783b4c..7e2e7dd4ae5842bc49ccaf5dc116deb3b3d6b993 100755 (executable)
@@ -33,7 +33,7 @@ test_expect_success 'setup' '
 '
 
 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' '
@@ -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 "$(test-index-version < .git/index)" = 3
+       test "$(test-tool index-version < .git/index)" = 3
 '
 
 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 "$(test-index-version < .git/index)" = 2
+       test "$(test-tool index-version < .git/index)" = 2
 '
 
 test_done