1
0
mirror of https://github.com/git/git synced 2024-06-30 22:54:27 +00:00

test-tool: retire "index-version"

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>
This commit is contained in:
Junio C Hamano 2023-09-12 12:32:35 -07:00
parent 606e088d5d
commit 83708f80fc
7 changed files with 5 additions and 23 deletions

View File

@ -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

View File

@ -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;
}

View 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 },

View 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);

View File

@ -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
)
}

View File

@ -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"

View File

@ -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