Re: [PATCH 0/6] worktree: initialize refdb via ref backends
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 28, 2023, 18:11 UTC
- Message-ID
- <xmqqedf6gpt8.fsf@gitster.g>
- In-Reply-To
- <cover.1703754513.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 11 quoted lines
> when initializing worktrees we manually create the on-disk data > structures required for the ref backend in "worktree.c". This works just > fine right now where we only have a single user-exposed ref backend, but > it will become unwieldy once we have multiple ref backends. This patch > series thus refactors how we initialize worktrees so that we can use > `refs_init_db()` to initialize required files for us. > > This patch series conflicts with ps/refstorage-extension. The conflict > can be solved as shown below. I'm happy to defer this patch series > though until the topic has landed on `master` in case this causes > issues.
Resolution is not all that bad, but the change in function signature means comments/explanations near both the caller and the callee of the get_linked_worktree() function may need updating, I would think. For example, ...
Show 11 quoted lines
> diff --git a/worktree.h b/worktree.h > index 8a75691eac..f14784a2ff 100644 > --- a/worktree.h > +++ b/worktree.h > @@ -61,7 +61,8 @@ struct worktree *find_worktree(struct worktree **list, > * Look up the worktree corresponding to `id`, or NULL of no such worktree > * exists. > */ > -struct worktree *get_linked_worktree(const char *id); > +struct worktree *get_linked_worktree(const char *id, > + int skip_reading_head);
... this now needs to help developers who may want to add new callers what to pass in "skip_reading_head" and why.
We may indeed want to build this on top of the refstorage-extansion thing, as it seems to be relatively close to completion.
Thanks (and a happy new year).