-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Handle repository format v1 #5388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d505c2a
to
4ad65c0
Compare
We need to have a plan for this, since it's hard to really know what extensions we support. Extensions are a mixed bag of plumbing and application layer configuration. Concretely: libgit2 can support I presume that this means that applications will need a mechanism by which they can register that they understand a particular extension, and then we can just claim understanding on their behalf when opening a config. One gotcha here is that git has specified identical language in the unknown extension in the configuration case as the unknown value to an extension configuration case:
One is to assume that "the operation MUST NOT proceed" in the first sentence must refer to literally any git operation, because you have no way of knowing whether the extension applies to the operation that you were asked to do. That is to say, if an implementation doesn't understand the However, if one is to apply that same thinking to the next sentence, then does 🤔 |
For more information, see the comments in #3253 |
Also - to clarify my comments above - I'm not looking for you to solve this problem here, I'm just talking it over. Obviously there are a great many extensions that we can implement ourselves without worrying about application support above us and certainly |
There's also some points here, about one way to implement those "extensions points", at the protocol level. I planned to share that with the repository layer, but never went through with it… It's been a while, as well 😉. |
I think there are several options that we can support out of the box just natively. You've mentioned All of that, however, is orthogonal to this series, which implements only the barest, most essential v1 repository format, and nothing more. My goal is to get SHA-256 support working, so at the moment, I'm not planning to offer folks a way to register extensions. That would be good and valuable work for someone else to pick up, though.
Yes, that's my understanding. If the config is set and not understood, no operation by that implementation may proceed on the repository.
Yes, I think we can have a list of extensions which we are willing to support, whether internally or with help from the program calling libgit2. If we don't know about it, then users can't specify that they handle it. That's the safe and robust approach. |
I agree. My concern is that the interface for users to specify this is severely disappointing, since they have to specify all the values that they support as well. If the extension model in git was to define the supported value range and keep it immutable, it would be significantly easier for us. That's not a thing we can solve here, of course, but I'll bring this up on the git mailing list. |
My own "design plan" had been to get #4856 merged first, mostly because the current repository open path is somewhat convoluted (there's a few discrepancies because of custom/in-memory repositories, worktrees and envvars collusion 😉). This would enable passing the supported list of options could be passed as part of repository opening, as a How to check for options would then be either handled internally as "the default list", a.k.a the only extensions libgit2 has support for/knows about, or delegated to the user's code. |
Git has supported repository format version 1 for some time. This format is just like version 0, but it supports extensions. Implementations must reject extensions that they don't support. Add support for this format version and reject any extensions but extensions.noop, which is the only extension we currently support. While we're at it, also clean up an error message.
4ad65c0
to
06f0230
Compare
I think I'd prefer to merge this series first, since #4856 appears to not have seen any changes since October and also isn't passing tests. This series should, with my latest changes, be ready to merge as it is. I realize it doesn't have a lot of additional support for user extensibility, but it is a framework to build upon, and it is also completely API-compatible with older versions. |
Seems reasonable. I think that there are open questions around how we support user-extensibility. We're basically locked down for the imminent 0.99, we'll |
@pks-t as well for review |
On Wed, Apr 01, 2020 at 02:24:05PM -0700, Edward Thomson wrote:
@pks-t as well for review
I'll review it soonish, thanks for the reminder. This is a requirement
for the reftable backend, so I'm interested in it anyway.
|
This PR looks fine as is to me, thanks a lot for working on it @bk2204!
I guess we need a mechanism similar to the transport registration, where an application may provide a callback it's being passed to all extensions that a repository requires. But, this is going to open a can of worms I've already been stumbling over when implementing reftables. Want to handle an extension that says the reference database is not the fs-backend one anymore? Well, good luck doing that without implementing this support in libgit2 directly. We'll need to grow more extensible in some places, refdbs is only one of them. And I'm not sure we can grow generic enough to allow applications to handle arbitrary extensions in the long run. Which doesn't mean we shouldn't try our best. Anyway, this PR is a good step in the right direction to support extensions at all and doesn't force us down any specific route, so I'm happy to merge it. Thanks again! |
Git has supported repository format version 1 for some time. This format is just like version 0, but it supports extensions. Implementations must reject extensions that they don't support.
Add support for this format version and reject any extensions but extensions.noop, which is the only extension we currently support.
This is a prerequisite to adding SHA-256 support.