On 8/3/2022 2:16 AM, Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> 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! >> + * 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