Thread (51 messages) 51 messages, 8 authors, 2022-12-02

Re: [PATCH 03/30] extensions: add refFormat extension

From: Derrick Stolee <hidden>
Date: 2022-11-16 14:37:09

On 11/11/22 6:39 PM, Elijah Newren wrote:
On Mon, Nov 7, 2022 at 10:48 AM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
[...]
quoted
One obvious improvement could be a new file format version for the
packed-refs file. Its current plaintext-based format is inefficient due
to storing object IDs as hexadecimal representations instead of in
their raw format. This extra cost will get worse with SHA-256.
quoted
In addition, binary searches need to guess a position and scan to find
newlines for a refname entry. A structured binary format could allow for
more compact representation and faster access.
This doesn't parse very well at all.  The scanning is due to refname
entries being of variable length, and changing hexadecimal
representation of object IDs to binary values isn't going to help
that.

I _think_, after re-scanning your RFC cover letter that you had other
ideas to allow a binary search in order to read a single ref's value,
and that the juxtaposing of these sentences together leads to an
unfortunate assumption that one change is related to the both goals,
but something extra here to clarify would help.
The v2 format has a structured list of offsets that can be used to
navigate directly to the ith ref in the file. Thus, we can use a
more precise form of binary search. Since we have these values, we
do not need to scan for newlines or spaces for the end of the ref
strings. This allows us to use the raw OIDs since we are not using
special characters as string boundaries.

I will work to clarify when I submit this for review.
quoted
diff --git a/Documentation/config/extensions.txt b/Documentation/config/extensions.txt
index bccaec7a963..ce8185adf53 100644
--- a/Documentation/config/extensions.txt
+++ b/Documentation/config/extensions.txt
@@ -7,6 +7,47 @@ Note that this setting should only be set by linkgit:git-init[1] or
 linkgit:git-clone[1].  Trying to change it after initialization will not
 work and will produce hard-to-diagnose issues.

+extensions.refFormat::
+       Specify the reference storage mechanisms used by the repoitory as a
+       multi-valued list. The acceptable values are `files` and `packed`.
quoted
+       If not specified, the list of `files` and `packed` is assumed.
This sentence doesn't parse for me.
quoted
+       It
+       is an error to specify this key unless `core.repositoryFormatVersion`
+       is 1.
...is at least 1?  Or are we trying to be incompatible with potential
future core.repositoryFormatVersion values?
Specifying exactly 1 is consistent across our extensions documentation.
The intention of the extensions system is that we should never need a
value 2 here. If we do, then we should consider all extensions to be
redesigned from scratch. Perhaps we'd have different defaults, or older
options not possible anymore.

Thanks,
-Stolee
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help