-
Notifications
You must be signed in to change notification settings - Fork 899
Idea: Separate Low Level LibGit2 Wrapper and Higher Level Convenience Classes #1998
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
Comments
The structure that you've proposed is roughly what I've tackled in Dogged. I played a bit with using codegen to build the the PInvoke layer, but I haven't had a lot of success yet. But I think that it's definitely the right approach, it's just something that I haven't really "nailed" yet so to speak. |
(I think that https://github.com/xoofx/GitLib.NET may be a good starting point.) |
The Dogged repo looks quite interesting. Would be good to hear a bit more about your long term plans around this lib and the relation to libgit2sharp. Will likely give it a shot to check what is there already and look if I could contribute some code generation aspects. If this project gets traction would be worth listing it on https://github.com/libgit2/libgit2#language-bindings (maybe for discussion over at the Dogged Repo) GitLib.NET might be a good reference to see how they solved some aspects, but it is also rather a dead project 😞 |
I echo the sentiments in this issue. The process of updating the Really wish this would get addressed, although, I am skeptical because I recall being told that there are no plans to address this. It is a severe usability issue. |
You're saying, in effect, why shouldn't you be able to update to the latest version of the native binaries package independent of the version of LibGit2Sharp that you use? This seems like a mismatch in expectations... Because the native binaries is the packaging for the native libraries, and LibGit2Sharp contains the pinvoke layer. Trying to use mismatched versions would crash your app hard. Isn't this often true for transitive dependencies, though? There's no guarantee that upgrading a thing that a thing that you use depends on will work? It's just more true for native dependencies where you crash hard instead of throwing. Does nuget have a version compatibility expression more like npm's? Is LibGit2Sharp not using it? If so, that should be able to resolve it. But maybe I don't understand - what's the actual use case for having mismatched versions? |
I agree to @ethomson that with the current situation this might be less a libgit2sharp problem than more a IDE problem. It it shouldn't offer an upgrade button in cases where dependency graphs cannot be fullfilled with an upgrade. In this case: For LibGit2Sharp.NativeBinaries VS/Rider should not provide an upgrade button if a LibGit2Sharp requires a certain lower version. But unfortunately this dependency is often only checked as part of the upgrade process itself leading to the mentioned error. On the other hand LibGit2Sharp with all NuGets could adopt at least a bit the versioning/deployment strategy to consider following aspects:
So somehow I agree with both of you 😁 |
I agree with the "split low-/high-level" sentiment; libgit2 itself is made for low-level, but some parts of LibGit2Sharp operate at a much higher level, without exposing the low-level. Eg I've recently wanted to use Also, some things are slower than they should be, eg A glance at the code feels like the high-level is relying a bit too much on managed stuff, eg:
... at high bandwidth, it's hard to imagine these things don't have an impact. |
@Danielku15 Sounds indeed like a good idea! Personally I would make it leave outside the scope of this repo as a fresh new start while keeping in mind that That's sad that a common initiative doesn't emerge. It's a pattern that I often see in the .NET ecosystem, new projects often come as personal initiatives and they're hard to sustain. Wouldn't it be great if @xoofx and @ethomson would collaborate on the same project? 🤩 |
Let me give my perspective on this topic 🙂
|
Thanks @xoofx for the details! Even if code generation would be great, I don't think it's mandatory. I would just help maintenance. Also, code generation could be used as a first draft and then it would be polished at hand. Finally, it doesn't tackle the fact that we need tests (cf xoofx/GitLib.NET#2). When you look at PRs here, a lot of them is about missing API from |
Agreed, it's not mandatory, and yes, maintenance wise is a major benefit of doing it automatically, but not only: if you really want to have consistency across the board, API documentation at least replicated, tracking changes new api/obsoleted API...etc. But anyway, the main problem is less about manual vs automatic but about your 2nd point (which was my last point 😁)
Firstly, I don't think that LibGit2Sharp is a good place to introduce this, as it has too much legacy... but more importantly, to have a low-level managed wrapper of libgit2, you need to have at least one folk (of course more is always better) that definitely needs this for a living (e.g strong dependence in a company) or for a super important personal project and would be ready to spend a few months to provide this. 🙂 |
What about Dogged? I've personally discovered it yesterday. Looks like a big step forward compared to LibGit2Sharp. |
I usually only care about the low level part so that would be more Dogged.Native. Most abstractions are going to cripple performance with managed allocations all around. It takes also more time to update such library, because not only you have to provide the low level part, but you need to think about how to shape the abstraction. It is a lot more work. Also the low level part is using raw pointers while I personally prefer to have struct handles (as I did in GitLib.NET, if a struct is used only through a pointer and doesn't have fields, then you can turn that struct itself in an abstract pointer - a struct wrapping a pointer, and you get rid of pointers in all APIs). Also, you can see that it is very laborious to get a proper coverage of the native API. Dogged here covers a fraction of the native API, and when you bring such API, you need to bring also the abstraction (As we can see with opened PRs) That's why, maintenance wise, doing that manually is more a problem, as you have to go through everything single details like that and make PR for each missing API and in the end, it requires more work in the long run and context switching (also for the maintainer). In OSS, if a project requires very frequent gardening to get basic stuffs, that becomes quickly problematic. |
As I was working again on my codegen tooling from C++ for other libraries, I gave libgit2 a 2nd try: https://github.com/XenoAtom/XenoAtom.Interop/tree/main/src/libgit2 |
Looking at the pace of this repository it seems due to the lack of contributors it almost appears that there is not much happening on this library and it is not really in a production ready state.
Git/LibGit2 are advancing fast and obviously it is hard to keep up the pace providing a full .net flavor on top of that.
Hence I was thinking of the following: What if there would be two packages around libgit2sharp:
We are concerned to use libgit2sharp in new projects due to its nature of not being maintained and uptodate. This implies risk of not getting bugfixes (feature and security wise) or new functionalities which are added to libgit2 in fast pace. I looked at how most .net tools currently interact with git and they seem to mostly rely on calling the git.exe and parse the outputs (I checked Visual Studio, Fork, GitHub Desktop and some other tools to evaluate how they do it) so we are left to either develop again an own framework for us, or rely on libgit2sharp which is struggling.
Let me know what you think of such an idea?
The text was updated successfully, but these errors were encountered: