diff mbox series

[v3,05/17] t/helper/test-read-graph.c: extract `dump_graph_info()`

Message ID 94552abf455c6d341a0811333ae4edb4a8cea259.1696969994.git.me@ttaylorr.com (mailing list archive)
State Superseded
Headers show
Series bloom: changed-path Bloom filters v2 (& sundries) | expand

Commit Message

Taylor Blau Oct. 10, 2023, 8:33 p.m. UTC
Prepare for the 'read-graph' test helper to perform other tasks besides
dumping high-level information about the commit-graph by extracting its
main routine into a separate function.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/helper/test-read-graph.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

Comments

Patrick Steinhardt Oct. 17, 2023, 8:45 a.m. UTC | #1
On Tue, Oct 10, 2023 at 04:33:33PM -0400, Taylor Blau wrote:
> Prepare for the 'read-graph' test helper to perform other tasks besides
> dumping high-level information about the commit-graph by extracting its
> main routine into a separate function.
> 
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>

Nit: your signoff is duplicated here. This is also still the case for
some of the other commits.

Patrick

> ---
>  t/helper/test-read-graph.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c
> index 8c7a83f578..3375392f6c 100644
> --- a/t/helper/test-read-graph.c
> +++ b/t/helper/test-read-graph.c
> @@ -5,20 +5,8 @@
>  #include "bloom.h"
>  #include "setup.h"
>  
> -int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
> +static void dump_graph_info(struct commit_graph *graph)
>  {
> -	struct commit_graph *graph = NULL;
> -	struct object_directory *odb;
> -
> -	setup_git_directory();
> -	odb = the_repository->objects->odb;
> -
> -	prepare_repo_settings(the_repository);
> -
> -	graph = read_commit_graph_one(the_repository, odb);
> -	if (!graph)
> -		return 1;
> -
>  	printf("header: %08x %d %d %d %d\n",
>  		ntohl(*(uint32_t*)graph->data),
>  		*(unsigned char*)(graph->data + 4),
> @@ -57,6 +45,23 @@ int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
>  	if (graph->topo_levels)
>  		printf(" topo_levels");
>  	printf("\n");
> +}
> +
> +int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
> +{
> +	struct commit_graph *graph = NULL;
> +	struct object_directory *odb;
> +
> +	setup_git_directory();
> +	odb = the_repository->objects->odb;
> +
> +	prepare_repo_settings(the_repository);
> +
> +	graph = read_commit_graph_one(the_repository, odb);
> +	if (!graph)
> +		return 1;
> +
> +	dump_graph_info(graph);
>  
>  	UNLEAK(graph);
>  
> -- 
> 2.42.0.342.g8bb3a896ee
>
Taylor Blau Oct. 18, 2023, 5:37 p.m. UTC | #2
On Tue, Oct 17, 2023 at 10:45:18AM +0200, Patrick Steinhardt wrote:
> On Tue, Oct 10, 2023 at 04:33:33PM -0400, Taylor Blau wrote:
> > Prepare for the 'read-graph' test helper to perform other tasks besides
> > dumping high-level information about the commit-graph by extracting its
> > main routine into a separate function.
> >
> > Signed-off-by: Taylor Blau <me@ttaylorr.com>
> > Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
> > Signed-off-by: Taylor Blau <me@ttaylorr.com>
>
> Nit: your signoff is duplicated here. This is also still the case for
> some of the other commits.

Yeah, this is an artifact of having tossed these patches back and forth
(originally Jonathan sent some of these, then I sent another round, then
Jonathan, now me again). It's a little verbose, but accurately tracks
the DCO across multiple rounds.

Thanks,
Taylor
Junio C Hamano Oct. 18, 2023, 11:56 p.m. UTC | #3
Taylor Blau <me@ttaylorr.com> writes:

> On Tue, Oct 17, 2023 at 10:45:18AM +0200, Patrick Steinhardt wrote:
>> On Tue, Oct 10, 2023 at 04:33:33PM -0400, Taylor Blau wrote:
>> > Prepare for the 'read-graph' test helper to perform other tasks besides
>> > dumping high-level information about the commit-graph by extracting its
>> > main routine into a separate function.
>> >
>> > Signed-off-by: Taylor Blau <me@ttaylorr.com>
>> > Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
>> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> > Signed-off-by: Taylor Blau <me@ttaylorr.com>
>>
>> Nit: your signoff is duplicated here. This is also still the case for
>> some of the other commits.
>
> Yeah, this is an artifact of having tossed these patches back and forth
> (originally Jonathan sent some of these, then I sent another round, then
> Jonathan, now me again). It's a little verbose, but accurately tracks
> the DCO across multiple rounds.

Well, between you and Jonathan Tan, that might be true, but my
involvement in the chain is only that I happened to have looked at
an earlier round and without doing anything else.  Even if you
refetched from my tree and based the new round on that version, it
would have been the same if you started from what you sent out
earlier without even looking at my tree.  So I do not think that
chain of DCO adds very little value by recording my sign-off there.
diff mbox series

Patch

diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c
index 8c7a83f578..3375392f6c 100644
--- a/t/helper/test-read-graph.c
+++ b/t/helper/test-read-graph.c
@@ -5,20 +5,8 @@ 
 #include "bloom.h"
 #include "setup.h"
 
-int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
+static void dump_graph_info(struct commit_graph *graph)
 {
-	struct commit_graph *graph = NULL;
-	struct object_directory *odb;
-
-	setup_git_directory();
-	odb = the_repository->objects->odb;
-
-	prepare_repo_settings(the_repository);
-
-	graph = read_commit_graph_one(the_repository, odb);
-	if (!graph)
-		return 1;
-
 	printf("header: %08x %d %d %d %d\n",
 		ntohl(*(uint32_t*)graph->data),
 		*(unsigned char*)(graph->data + 4),
@@ -57,6 +45,23 @@  int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
 	if (graph->topo_levels)
 		printf(" topo_levels");
 	printf("\n");
+}
+
+int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
+{
+	struct commit_graph *graph = NULL;
+	struct object_directory *odb;
+
+	setup_git_directory();
+	odb = the_repository->objects->odb;
+
+	prepare_repo_settings(the_repository);
+
+	graph = read_commit_graph_one(the_repository, odb);
+	if (!graph)
+		return 1;
+
+	dump_graph_info(graph);
 
 	UNLEAK(graph);