-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Support custom git extensions #6031
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
/cc @jairbubbles |
2cbae75
to
21dd15b
Compare
Allow users to specify additional repository extensions that they want to support. For example, callers can specify that they support `preciousObjects` and then may open repositories that support `extensions.preciousObjects`. Similarly, callers may opt out of supporting extensions that the library itself supports.
21dd15b
to
a24e656
Compare
Thx @ethomson, I created a draft PR to test it in libgit2sharp: libgit2/libgit2sharp#1908 I can confirm it works as expected as I was able to open repositories with "partialclone" extension! 🤘🏼 While writing the tests I was not sure about the behavior when setting the extensions two times in a row: GlobalSettings.SetExtensions(new[] { "!noop" });
Assert.Empty(GlobalSettings.GetExtensions());
GlobalSettings.SetExtensions(new[] { "partialclone", "newext" });
Assert.Equal(new[] { "noop", "partialclone", "newext" }, GlobalSettings.GetExtensions()); // 👈🏼 I expected "noop" to remain disabled |
Right - sorry, I expect you to call it one time with what you support. (Subsequent calls will reset the supported extensions.) I think that this is not super important in practice since most people will only call it once at startup and forget about it. But it made testing easier in the library. If you have strong opinions that I did this wrong then I'm definitely open to reconsidering. |
@ethomson Not at all, I just mentioned it in case this behavior was not expected. |
@@ -367,6 +368,28 @@ int git_libgit2_opts(int key, ...) | |||
git_odb__loose_priority = va_arg(ap, int); | |||
break; | |||
|
|||
case GIT_OPT_SET_EXTENSIONS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(code indent looks incorrect)
🥳 |
@ethomson Do you plan to release a version that includes this in a near future? |
@jairbubbles Yes. I would like to do a v1.3.0 this weekend. |
Sounds like a nice plan. I'll wait for 1.3.0 and update it in libGit2Sharp. |
- C# wrapper for libgit2/libgit2#6031 (I'm not sure at all for the P/Invoke code)
- C# wrapper for libgit2/libgit2#6031 (I'm not sure at all for the P/Invoke code)
This would allow one to use git worktrees together with sparse-checkout. Reference: libgit2/libgit2#6031
* Add support for custom git extensions This would allow one to use git worktrees together with sparse-checkout. Reference: libgit2/libgit2#6031 * Mark extension methods unsafe * Replace custom spin-lock in tests with serial-test crate * Rewrite tests as integration tests
Allow users to specify additional repository extensions that they want to support. For example, callers can specify that they support
preciousObjects
and then may open repositories that supportextensions.preciousObjects
.Similarly, callers may opt out of supporting extensions that the library itself supports.