-
Notifications
You must be signed in to change notification settings - Fork 890
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
Update LibGit2 to version 1.1.1 #1905
Conversation
a8a546e
to
85ad389
Compare
Codecov Report
@@ Coverage Diff @@
## master #1905 +/- ##
==========================================
- Coverage 84.81% 84.80% -0.01%
==========================================
Files 231 231
Lines 9125 9120 -5
==========================================
- Hits 7739 7734 -5
Misses 1386 1386
Continue to review full report at Codecov.
|
Hi, is there an update on this draft or any ETA on when it will be merged to master? It contains an important update to allow git version 1 which would be amazing to have for sparse checkouts, partial clones etc. |
Hi @skysb! The PR is pretty new so give some time to the maintainers 😅. It's still draft as it's using as pre-release version of @bording Do you think it's possible to publish a pre-release version of this package? Also I feel like it would make sense to publish the current as a stable |
Yes, I should be able to publish a new preview once this gets merged.
I'm a bit reluctant to do that as this point because the 0.27.0 preview packages include the change over to a managed HTTPS implementation that is definitely a bit experimental, and does seem to be causing some problems. I'd prefer to wait for libgit2/libgit2#5974 to be merged, pull that into the native binaries package, and then revert the managed HTTPs changes. |
But I don't think we can merge with the prerelease package referenced? |
Why not? The prerelease native package is on nuget.org, so a preview LibGit2Sharp could be released that references it. |
Let me undraft then! 😊 |
0.27.0-preview-0119 is up on nuget.org now. |
Thanks for this! In Windows is working like a charm with partial cloned repos but in Linux I'm having the next error message: LibGit2Sharp.LibGit2SharpException: 'unsupported extension name extensions.partialclone' Any clue? |
libgit2 doesn't support partial clones or sparse checkouts. I think that the update that you're referring to allows us to understand the repository format v1, which adds in new optional extensions (like partial clones or sparse checkouts). The update in libgit2 only allows us to know that we don't support the repository's extensions. |
Hi @ethomson , You are right, I didn't explain myself correctly in the post. The idea was to be able to identify v0 from v1 only, as when we tried instantiating a new repository with a partially cloned repository, we got an error saying it wasn't supported. |
Hi @alfonsarmi , I am getting the same issue. When trying to instantiate a partially cloned repository, I get the same error. @jairbubbles would this be something related to the native binaries? as in windows it works well but in linux (docker images) it fails for me with the error
|
I don't explain why there's a different behavior between Linux and Windows. I quickly looked at the code and there's no If I understand correctly @ethomson's answer, we should get the error 'unsupported extension name extensions.partialclone' on both platforms. For my use case, I was also able to open a partially cloned repository and access the info I needed (on Windows). Please note that I don't use libgit2sharp to run actions on the repository, it's only used to inspect it. I guess that it mostly works correctly even for partially cloned repositories. @alfonsarmi @skysb Can you share the git commands you use to clone your repository? |
The gitclone command I am currently using is
Using libgit2sharp, just doing a
raises the exception stated above, but only in linux, and not in windows. I hope this helps as I am pretty new to this! Thanks! |
@skysb Did you test it thoroughly? I guess it will fail as soon as we need to get file content on an object which is not yet retrieved. For instance when using |
Exactly the same problem in Linux, cannot "just read to inspect the directory tree" the repository folder. I'm also using a --filter=blob:limit command in git to get a partial clone |
Well, I can't test it until it lets me instantiate the repository right? |
Sorry @skysb I guess you only work on Linux on your side. |
And my question was more: "Did you test it thoroughly on Windows?" |
Hi guys, Just in case it helps... @jairbubbles @skysb @ethomson @bording I tested this thoroughly in Windows with a partially cloned repository. So I could instanciate the Repository folder ( The only difference is that those filtered files (more than 1 megabyte) have no blob content, but everything else works. It is not the case on a Linux container, as I cannot even instanciate the Repository ( I think it something with the NativeLibraries for Linux... but I'm not sure. |
@alfonsarmi @skysb What version of git you're using on Linux to do the clone? It might explain the different behaviors. When looking at https://git-scm.com/docs/repository-version#_partialclone it seems that "extensions.partialclone" should be set in the .git config of the repo. |
Hi @jairbubbles The version of git we use in docker is always the latest version available. In fact, if I understand the documentation correctly, what it means to say is that when cloning the repository, in the config file created, the variables should already be set in that way if its a partial clone. It's not a manual config I need to modify to be able to clone the repository in a certain way. The following is an example of the config file in windows when I carried out the partial clone using the git filter commands: And this is an example of the config file downloaded in the linux machine: both configs seem to be set correctly and the repositories seem to be downloaded correctly, the only issue is the instantiation of the repository in windows and linux, where in linux it fails, and in windows it doesn't which is why I suspected it to be related to native libraries maybe? as they seem to have a build for each OS? Hope this helps in some way! |
Thx @skysb, That's very weird because in both cases "extensions.partialclone" is set so you should get the error on both platforms when opening the repo with libgit2sharp. On my side I didn't get this in the .git config for Windows & WSL which confuses me even more:
EDIT: when I manually set "extensions.partialclone" I can't open the repository on Windows, I get the error which doesn't surprise me as the code in libgit2 is pretty straight forward. |
@ethomson How would you feel about logging only a warning when "extensions.partialclone" is set indicating that some features won't work properly rather than not opening the repo at all? |
Hi @jairbubbles - the purpose of the extensions is truly to communicate non-optional functionality and prevent unsupported git tools from opening the repository because they may corrupt the repository. A warning would not be appropriate in this case. We should provide a mechanism to libgit2 users to indicate that they understand the extension - for example, the extension indicating that objects cannot be removed is a concept that users would need to "opt in" to. This is something I was thinking about after the upcoming 1.2 release. |
(I'm happy to add an unsupported extension error code.) |
Cool but if it exists before the repo is initialized it won't fix what we try to achieve, ie inspecting partially cloned repository through libgit2. Some kind of read-only open would make sense? |
This would actually help us a lot. Being able to at least have a read-only open to inspect it and it would be a significant improvement over just raising an error, as now there many people that are opting for partially cloned repos where the repo size is huge. |
Sorry if my comment about writing corrupt repositories suggested that writing was the only concern. Reading is a similar problem. There's no read only view of a repo with sha256, for example. So it's not like we can ignore extensions if you are opening a repo read only. We would still need this mechanism for you to tell us what extensions you understand. |
Yes @ethomson but in our case we're speaking only about the "partialclone" extension. The behavior regarding other extensions is another concern. |
I'm sorry, this is just not a viable path forward. Adding read-only support for repositories is not a trivial undertaking, and while it might solve your needs, it's not a particularly elegant solution nor a general purpose one. Adding a mechanism where users tell us the extensions that they support has the advantage of being both easier and a necessary for the library anyway. |
I really don't have any preference, I was just brainstorming around our use case. I don't exacly see what you have in mind and I don't see how as a client of the library I can "handle" an extension. In our case it would be just a way to tell "I know what I do, the repo is partially cloned that's fine with me, I'm just going to inspect it". |
Ah! Sorry, my bad. Yes, that's precisely what I have in mind. libgit2 needs a system where the user can say "hey, I know how to handle this extension" and then when we see a repo that has that extension, we continue. Otherwise, we'll block as we do today. At app startup, you'll just say "hey I know what to do with these extensions" and then we'll open any repositories that have that extension and you can do what you wish. Eventually, we'll have some set of extensions that we support ourselves: new sha format, for example, won't need to be opt-in (though it could be opt out). But you'll be able to opt in to extensions that we don't know anything about (like this one). I'll see if I can tackle this over the weekend. |
@ethomson Well that would all make us very happy here. I can look at the C# part if you'd like. |
There are some good things coming here: #1908 😏 |
@jairbubbles That sounds awesome and promising! Once approved, would there be a nuget package created for it too? |
@jairbubbles youre a ⭐ !! Would #1908 mean we can download partially cloned repos (like blobless files) and initialize the repo or would we need to wait for #1909 for the feature? Cheers |
#1908 will be enough. #1909 is a quality of life PR on top of it. Many methods throw when the blobs are not available, you can already try / catch but I feel like it's not very pretty as it generates many different exceptions depending on the called method (sometimes It's just a draft, I'm also considering throwing a new |
This is fantastic guys! Many thanks! @jairbubbles looks like the merge's checks have failed. Any plan to get this fixed any time soon? Thanks! |
@alfonsarmi Yes I need to consume the new native binaries but they are not yet on nuget.org. I'll make a PR as soon as version 1.3 is tagged, should be this week-end. |
Hello! Any updates on the PR? should this discussion move to the other PR instead?? @jairbubbles |
Hello @skysb libgit2 was not tagged, I will update to a commit containing the fix. As long as we're sill in pre-release I think it's ok. |
👍 LibGit2Sharp has a long history of using unreleased commits. 😁 I wanted to do a little more testing before I land v1.3.0 over in libgit2. |
@ethomson @jairbubbles Any updates on this? |
fromnoun
tofrom_noun
(with an underscore) libgit2#5117 and Return int from non-free functions libgit2#5365)