git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 03/16] refs: implement releasing ref storages

From
Patrick Steinhardt <ps@pks.im>
Date
May 17, 2024, 07:08 UTC
Message-ID
<ZkcCh3OhbPOn0HOF@tanuki>
In-Reply-To
<CAOLa=ZT3VqhrHXt9x-4DN7norTb3RuscBx+VHipn=QxJvwwThQ@mail.gmail.com>
On Thu, May 16, 2024 at 11:39:36AM -0500, Karthik Nayak wrote:
Show 17 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> [snip]
> 
> > diff --git a/refs/debug.c b/refs/debug.c
> > index 58fb4557ed..27aae42134 100644
> > --- a/refs/debug.c
> > +++ b/refs/debug.c
> > @@ -33,6 +33,12 @@ struct ref_store *maybe_debug_wrap_ref_store(const char *gitdir, struct ref_stor
> >  	return (struct ref_store *)res;
> >  }
> >
> > +static void debug_release(struct ref_store *refs)
> > +{
> > +	struct debug_ref_store *drefs = (struct debug_ref_store *)refs;
> 
> We should probably add a trace here, using `trace_printf_key()`

I didn't because we don't have `debug_init()` with a trace, either, and because there is no error code that we could report. But on the other hand it does not hurt to have it here, so let's just add it.

[snip]
Show 24 quoted lines
> > diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> > index a4bb71cd76..6c262c2193 100644
> > --- a/refs/reftable-backend.c
> > +++ b/refs/reftable-backend.c
> > @@ -293,6 +293,27 @@ static struct ref_store *reftable_be_init(struct repository *repo,
> >  	return &refs->base;
> >  }
> >
> > +static void reftable_be_release(struct ref_store *ref_store)
> > +{
> > +	struct reftable_ref_store *refs = reftable_be_downcast(ref_store, 0, "release");
> > +	struct strmap_entry *entry;
> > +	struct hashmap_iter iter;
> > +
> > +	if (refs->main_stack) {
> > +		reftable_stack_destroy(refs->main_stack);
> > +		refs->main_stack = NULL;
> > +	}
> > +
> > +	if (refs->worktree_stack) {
> > +		reftable_stack_destroy(refs->worktree_stack);
> > +		refs->main_stack = NULL;
> 
> This should be `refs->worktree_stack`, right?
Good catch, yes.
Patrick
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 12 of 33 in “refs: drop all references to `the_repository`”
  1. 00/16 refs: drop all references to `the_repository`Patrick Steinhardt, May 16, 2024
  2. 01/16 refs: adjust names for `init` and `init_db` callbacksPatrick Steinhardt, May 16, 2024
  3. Karthik NayakMay 16, 2024
  4. 02/16 refs: rename `init_db` callback to avoid confusionPatrick Steinhardt, May 16, 2024
  5. Karthik NayakMay 16, 2024
  6. Junio C HamanoMay 16, 2024
  7. Patrick SteinhardtMay 17, 2024
  8. 03/16 refs: implement releasing ref storagesPatrick Steinhardt, May 16, 2024
  9. Karthik NayakMay 16, 2024
  10. Junio C HamanoMay 16, 2024
  11. Patrick SteinhardtMay 17, 2024
  12. Patrick SteinhardtMay 17, 2024
  13. 04/16 refs: track ref stores via strmapPatrick Steinhardt, May 16, 2024
  14. Junio C HamanoMay 16, 2024
  15. 05/16 refs: pass repo when retrieving submodule ref storePatrick Steinhardt, May 16, 2024
  16. Junio C HamanoMay 16, 2024
  17. Patrick SteinhardtMay 17, 2024
  18. 06/16 refs: refactor `resolve_gitlink_ref()` to accept a repositoryPatrick Steinhardt, May 16, 2024
  19. Junio C HamanoMay 16, 2024
  20. 07/16 refs: retrieve worktree ref stores via associated repositoryPatrick Steinhardt, May 16, 2024
  21. 08/16 refs: convert iteration over replace refs to accept ref storePatrick Steinhardt, May 16, 2024
  22. 09/16 refs: pass ref store when detecting dangling symrefsPatrick Steinhardt, May 16, 2024
  23. 10/16 refs: move object peeling into "object.c"Patrick Steinhardt, May 16, 2024
  24. Junio C HamanoMay 16, 2024
  25. 11/16 refs: pass repo when peeling objectsPatrick Steinhardt, May 16, 2024
  26. 12/16 refs: drop `git_default_branch_name()`Patrick Steinhardt, May 16, 2024
  27. Karthik NayakMay 16, 2024
  28. 13/16 refs: remove `dwim_log()`Patrick Steinhardt, May 16, 2024
  29. 14/16 refs/files: use correct repositoryPatrick Steinhardt, May 16, 2024
  30. 15/16 refs/files: remove references to `the_hash_algo`Patrick Steinhardt, May 16, 2024
  31. 16/16 refs/packed: remove references to `the_hash_algo`Patrick Steinhardt, May 16, 2024
  32. Karthik NayakMay 16, 2024
  33. Patrick SteinhardtMay 17, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.