]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-tool: retire "index-version"
authorJunio C Hamano <gitster@pobox.com>
Tue, 12 Sep 2023 19:32:35 +0000 (12:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Sep 2023 23:21:53 +0000 (16:21 -0700)
As "git update-index --show-index-version" can do the same thing,
the 'index-version' subcommand in the test-tool lost its reason to
exist.  Remove it and replace its use with the end-user facing
'git update-index --show-index-version'.

Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/test-index-version.c [deleted file]
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 e440728c2461b9367e01db5a817ae48479afcf65..5323c76aa067ccb16db0db191773258d7d31a44e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -808,7 +808,6 @@ TEST_BUILTINS_OBJS += test-hash-speed.o
 TEST_BUILTINS_OBJS += test-hash.o
 TEST_BUILTINS_OBJS += test-hashmap.o
 TEST_BUILTINS_OBJS += test-hexdump.o
-TEST_BUILTINS_OBJS += test-index-version.o
 TEST_BUILTINS_OBJS += test-json-writer.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-match-trees.o
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
deleted file mode 100644 (file)
index a06c45c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "test-tool.h"
-#include "cache.h"
-
-int cmd__index_version(int argc UNUSED, const char **argv UNUSED)
-{
-       struct cache_header hdr;
-       int version;
-
-       memset(&hdr,0,sizeof(hdr));
-       if (read(0, &hdr, sizeof(hdr)) != sizeof(hdr))
-               return 0;
-       version = ntohl(hdr.hdr_version);
-       printf("%d\n", version);
-       return 0;
-}
index abe8a785eb651017ce2336eed7fa3bda06d4658c..621ac3dd107b077e090c9217d68ab1523f9e4a12 100644 (file)
@@ -38,7 +38,6 @@ static struct test_cmd cmds[] = {
        { "hashmap", cmd__hashmap },
        { "hash-speed", cmd__hash_speed },
        { "hexdump", cmd__hexdump },
-       { "index-version", cmd__index_version },
        { "json-writer", cmd__json_writer },
        { "lazy-init-name-hash", cmd__lazy_init_name_hash },
        { "match-trees", cmd__match_trees },
index ea2672436c9ab56ed544d0a3ff414c366de5fdc0..a641c3a81d7d84118e8069050245871ebbb93fbb 100644 (file)
@@ -32,7 +32,6 @@ int cmd__getcwd(int argc, const char **argv);
 int cmd__hashmap(int argc, const char **argv);
 int cmd__hash_speed(int argc, const char **argv);
 int cmd__hexdump(int argc, const char **argv);
-int cmd__index_version(int argc, const char **argv);
 int cmd__json_writer(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__match_trees(int argc, const char **argv);
index 9368d82f7d70ca8133616ed40f167ae4344266c4..62e7fd15964bba7cbc8904471879027219368951 100755 (executable)
@@ -118,7 +118,7 @@ test_index_version () {
                fi &&
                git add a &&
                echo $EXPECTED_OUTPUT_VERSION >expect &&
-               test-tool index-version <.git/index >actual &&
+               git update-index --show-index-version >actual &&
                test_cmp expect actual
        )
 }
index b4ab166369ec06c69add33eb240d69531459276c..a7b7263b35d1d8f142eec5311c9e42c25e398878 100755 (executable)
@@ -43,7 +43,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-tool index-version <.git/index) &&
+       indexversion=$(git update-index --show-index-version) &&
 
        # NEEDSWORK: Stop hard-coding checksums.
        if test "$indexversion" = "4"
index b8686aabd38b5ac8a60753bff80fddd4e91a5102..0bab134d71d3e785194562779ef63085de4e6545 100755 (executable)
@@ -39,7 +39,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'index is at version 2' '
-       test "$(test-tool index-version < .git/index)" = 2
+       test "$(git update-index --show-index-version)" = 2
 '
 
 test_expect_success 'update-index --skip-worktree' '
@@ -48,7 +48,7 @@ test_expect_success 'update-index --skip-worktree' '
 '
 
 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
-       test "$(test-tool index-version < .git/index)" = 3
+       test "$(git update-index --show-index-version)" = 3
 '
 
 test_expect_success 'ls-files -t' '
@@ -61,7 +61,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-tool index-version < .git/index)" = 2
+       test "$(git update-index --show-index-version)" = 2
 '
 
 test_done