Move 'git commit-graph read' subcommand to test helper
Subsystems (2)
cover Move 'git commit-graph read' subcommand to test helper
As discussed [1], the 'git commit-graph read' subcommand has little value to users and should instead live in a test helper. The implementation was able to move almost wholesale, with only some new code to find the default object directory. This was necessary because of some tests that use a bare repository.
Thanks, -Stolee
[1]
https://public-inbox.org/git/CAGyf7-G3NDp--2nUbri_0EqvSLF21M0gsFCOKDCWMY+e68Htog@mail.gmail.com/
Derrick Stolee (1):
test-tool: use 'read-graph' helper
Documentation/git-commit-graph.txt | 12 ------ Makefile | 1 + builtin/commit-graph.c | 68 ------------------------------ t/helper/test-read-graph.c | 53 +++++++++++++++++++++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t5318-commit-graph.sh | 2 +- t/t5324-split-commit-graph.sh | 2 +- 8 files changed, 58 insertions(+), 82 deletions(-) create mode 100644 t/helper/test-read-graph.c
base-commit: d9f6f3b6195a0ca35642561e530798ad1469bd41
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-460%2Fderrickstolee%2Fcommit-graph-read-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-460/derrickstolee/commit-graph-read-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/460
Signature · 1 line
gitgitgadget
PATCH 1/1 test-tool: use 'read-graph' helper
From: Derrick Stolee <[email protected]>
The 'git commit-graph read' subcommand is used in test scripts to check that the commit-graph contents match the expected data. Mostly, this helps check the header information and the list of chunks. Users do not need this information, so move the functionality to a test helper.
--- Documentation/git-commit-graph.txt | 12 ------ Makefile | 1 + builtin/commit-graph.c | 68 ------------------------------ t/helper/test-read-graph.c | 53 +++++++++++++++++++++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t5318-commit-graph.sh | 2 +- t/t5324-split-commit-graph.sh | 2 +- 8 files changed, 58 insertions(+), 82 deletions(-) create mode 100644 t/helper/test-read-graph.c
Documentation/git-commit-graph.txt +0 -12
@@ -9,7 +9,6 @@ git-commit-graph - Write and verify Git commit-graph files SYNOPSIS -------- [verse] -'git commit-graph read' [--object-dir <dir>] 'git commit-graph verify' [--object-dir <dir>] [--shallow] [--[no-]progress] 'git commit-graph write' <options> [--object-dir <dir>] [--[no-]progress]
@@ -74,11 +73,6 @@ Finally, if `--expire-time=<datetime>` is not specified, let `datetime` be the current time. After writing the split commit-graph, delete all unused commit-graph whose modified times are older than `datetime`. -'read':: - -Read the commit-graph file and output basic details about it. -Used for debugging purposes. - 'verify':: Read the commit-graph file and verify its contents against the object
@@ -118,12 +112,6 @@ $ git show-ref -s | git commit-graph write --stdin-commits $ git rev-parse HEAD | git commit-graph write --stdin-commits --append ------------------------------------------------ -* Read basic information from the commit-graph file. -+ ------------------------------------------------- -$ git commit-graph read ------------------------------------------------- - GIT ---
Makefile +1 -0
@@ -727,6 +727,7 @@ TEST_BUILTINS_OBJS += test-prio-queue.o TEST_BUILTINS_OBJS += test-progress.o TEST_BUILTINS_OBJS += test-reach.o TEST_BUILTINS_OBJS += test-read-cache.o +TEST_BUILTINS_OBJS += test-read-graph.o TEST_BUILTINS_OBJS += test-read-midx.o TEST_BUILTINS_OBJS += test-ref-store.o TEST_BUILTINS_OBJS += test-regex.o
builtin/commit-graph.c +0 -68
92 lines not on this page · raw message
t/helper/test-read-graph.c new file +53 -0
53 lines not on this page · raw message
t/helper/test-tool.c +1 -0
@@ -45,6 +45,7 @@ static struct test_cmd cmds[] = { { "progress", cmd__progress }, { "reach", cmd__reach }, { "read-cache", cmd__read_cache }, + { "read-graph", cmd__read_graph }, { "read-midx", cmd__read_midx }, { "ref-store", cmd__ref_store }, { "regex", cmd__regex },
t/helper/test-tool.h +1 -0
@@ -35,6 +35,7 @@ int cmd__prio_queue(int argc, const char **argv);int cmd__progress (int argc,const char **argv);int cmd__reach (int argc,const char **argv);int cmd__read_cache (int argc,const char **argv); +int cmd__read_graph (int argc,const char **argv);int cmd__read_midx (int argc,const char **argv);int cmd__ref_store (int argc,const char **argv);int cmd__regex (int argc,const char **argv);
t/t5318-commit-graph.sh +1 -1
@@ -85,7 +85,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL EOF - git commit-graph read >output && + test-tool read-graph >output && test_cmp expect output }
t/t5324-split-commit-graph.sh +1 -1
@@ -25,7 +25,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata EOF - git commit-graph read >output && + test-tool read-graph >output && test_cmp expect output }
Signature · 1 line
gitgitgadget
Re: [PATCH 1/1] test-tool: use 'read-graph' helper
Quoted 6 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
The 'git commit-graph read' subcommand is used in test scripts to check that the commit-graph contents match the expected data. Mostly, this helps check the header information and the list of chunks. Users do not need this information, so move the functionality to a test helper.
This looks good to me.
Quoted 1 line
t/helper/test-read-graph.c | 53 +++++++++++++++++++++++
I wondered if we might want a commit-graph test-tool with sub-commands. But it probably doesn't matter. This would be the only thing in it. And there's less need these days to keep the number of tools down, since they're all linked into the same binary. And we can always change it later, since it's not a public interface.
So this is the simplest thing, which is probably best for now.
-Peff