Re: [PATCH v2 03/10] refs: add array of ref namespaces
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Aug 4, 2022, 13:29 UTC
- Message-ID
- <9d60ae93-5acf-cf26-f0ab-cc2aa0808f7e@github.com>
- In-Reply-To
- <xmqqzggldf7y.fsf@gitster.g>
On 8/3/2022 2:16 AM, Junio C Hamano wrote:
Show 24 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> + [NAMESPACE_REPLACE] = {
>> + /*
>> + * This namespace allows Git to act as if one object ID
>> + * points to the content of another. Unlike the other
>> + * ref namespaces, this one can be changed by the
>> + * GIT_REPLACE_REF_BASE environment variable. This
>> + * .namespace value will be overwritten in setup_git_env().
>> + */
>
> Thanks---it is a shame that we have unnecessary flexibility that
> requires us to have this code.
>
>> + .ref = "refs/replace/",
>> + .decoration = DECORATION_GRAFTED,
>> + },
>> + [NAMESPACE_NOTES] = {
>> + /*
>> + * The refs/notes/commit ref points to the tip of a
>> + * parallel commit history that adds metadata to commits
>> + * in the normal history. This branch can be overwritten
>
> This is not "branch" but is a ref.Thanks!
Show 10 quoted lines
>> + * by the core.notesRef config variable or the >> + * GIT_NOTES_REFS environment variable. >> + */ >> + .ref = "refs/notes/commit", >> + .exact = 1, > > Allowing just "the default" to be replaced by another "custom > default" is a good start, but we probably want to support more than > one notes refs, to parallel how "struct display_notes_opt" has > extra_notes_refs to allow multiple notes refs to decorate objects.
I imagine that if we allowed multiple notes refs, then we would need to use a ref prefix to define a namespace. If we relaxed that, then we could modify this as follows:
.ref = "refs/notes/", /* .exact = 0, */
(The comment is included just to illustrate the change.)
There is additional logic in init_notes() to track multiple notes refs, but the change to things that use ref_namespaces would be minimal.
Thanks, -Stolee