Re: [PATCH v2 10/15] t/helper: inline `reftable_stack_print_directory()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 20, 2024 at 09:34:21AM +0200, karthik nayak wrote:
> Patrick Steinhardt <ps@xxxxxx> writes:
> 
> > Move `reftable_stack_print_directory()` into the "dump-reftable" helper.
> > This follows the same reasoning as the preceding commit.
> >
> > Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> > ---
> >  reftable/reftable-stack.h |  3 ---
> >  reftable/stack.c          | 20 --------------------
> >  reftable/stack_test.c     |  7 -------
> >  t/helper/test-reftable.c  | 23 ++++++++++++++++++++++-
> >  4 files changed, 22 insertions(+), 31 deletions(-)
> >
> > diff --git a/reftable/reftable-stack.h b/reftable/reftable-stack.h
> > index 09e97c9991..f4f8cabc7f 100644
> > --- a/reftable/reftable-stack.h
> > +++ b/reftable/reftable-stack.h
> > @@ -140,7 +140,4 @@ struct reftable_compaction_stats {
> >  struct reftable_compaction_stats *
> >  reftable_stack_compaction_stats(struct reftable_stack *st);
> >
> > -/* print the entire stack represented by the directory */
> > -int reftable_stack_print_directory(const char *stackdir, uint32_t hash_id);
> > -
> >  #endif
> > diff --git a/reftable/stack.c b/reftable/stack.c
> > index d08ec00959..bedd503e7e 100644
> > --- a/reftable/stack.c
> > +++ b/reftable/stack.c
> > @@ -1603,23 +1603,3 @@ int reftable_stack_clean(struct reftable_stack *st)
> >  	reftable_addition_destroy(add);
> >  	return err;
> >  }
> > -
> > -int reftable_stack_print_directory(const char *stackdir, uint32_t hash_id)
> > -{
> > -	struct reftable_stack *stack = NULL;
> > -	struct reftable_write_options opts = { .hash_id = hash_id };
> > -	struct reftable_merged_table *merged = NULL;
> > -	struct reftable_table table = { NULL };
> > -
> > -	int err = reftable_new_stack(&stack, stackdir, &opts);
> > -	if (err < 0)
> > -		goto done;
> > -
> > -	merged = reftable_stack_merged_table(stack);
> > -	reftable_table_from_merged_table(&table, merged);
> > -	err = reftable_table_print(&table);
> > -done:
> > -	if (stack)
> > -		reftable_stack_destroy(stack);
> > -	return err;
> > -}
> > diff --git a/reftable/stack_test.c b/reftable/stack_test.c
> > index dbca9eaf4a..42044ed8a3 100644
> > --- a/reftable/stack_test.c
> > +++ b/reftable/stack_test.c
> > @@ -179,13 +179,6 @@ static void test_reftable_stack_add_one(void)
> >  	EXPECT(0 == strcmp("master", dest.value.symref));
> >  	EXPECT(st->readers_len > 0);
> >
> > -	printf("testing print functionality:\n");
> > -	err = reftable_stack_print_directory(dir, GIT_SHA1_FORMAT_ID);
> > -	EXPECT_ERR(err);
> > -
> > -	err = reftable_stack_print_directory(dir, GIT_SHA256_FORMAT_ID);
> > -	EXPECT(err == REFTABLE_FORMAT_ERROR);
> > -
> >
> 
> We loose this test due to the movement. It is okay, because the code
> that it is testing, is now only available in the testing section and is
> a test-helper. But it would be nice to mention this in the commit
> message.

Ah, good point, I'll mention that. The test was basically worthless
anyway as we didn't very anything -- only that it doesn't crash.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux