-
Notifications
You must be signed in to change notification settings - Fork 15
Why LibGit2Sharp? #53
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
There were three reasons for picking it. The main one is that Posh-Git calls the native exe. If we were satisfied with that, we probably wouldn't have created this in the first place. The second reason is the motivation for making a module: we wanted to work with objects. Making objects by parsing the text output of git is slow and fragile, since there aren't really guarantees about the text output. The third reason is just that we wanted a self-contained module that would "just work." Using a library means Now it's your turn: why not? I haven't done anything with hooks outside of hosted repositories like github and gitlab -- do you have a collection of these that don't work with libgit2sharp's hooks? |
Posh-Git does call the native exe but it doesn't provide much utility around it. And because git is from the Linux world were text parsing is the norm they have switches to freeze response formats. Last I knew libgit2sharp doesn't support any hooks. We use hooks at work for automation and testing. Other advantages of using the native exe are that there is no P/Invoke (which can be slow) and that while yes lack of dependencies can be good that lack is only true on Windows. PowerShell on *nix/macOS would require Mono (on top of Core which PowerShell needs). I'm not trying to convince you to switch and I apologize if I came across that way. |
It's true Posh-Git doesn't add much (well, tab-completion, now), but I'm pretty sure they'd accept PRs to add more ;-) LibGit2Sharp is porting to .Net Core, and I think it looks almost ready, so I don't expect there will be an extra dependency. For what it's worth, I don't think P/Invoke comes anywhere near text parsing for slowness ;-) The hook stuff would be a strong argument, except I've never used them ;-) I really thought the git-hooks feature was merged a couple years ago, and mostly working... but like I said, I don't use them so I just don't know 😁 Yeah, no worries -- just curious why it would matter. 🤷♂️ |
FWIW, this was discussed at length for posh-git here before this project was thing. We do include a few useful Git functions beyond prompt and tab expansion, but I'm generally content to keep the project focused on those particular features. |
@dahlbyk it's actually that issue that helped me find this project! I completely agree that posh-git should stay with its current goals. LibGit2Sharp being ported to Core is great news! I think the speed of P/Invoke vs text parsing is a case of It Depends™ 😆 I admit the hooks are a bit of a niche usage case. I think I'll continue work on my text parsing one, mostly as an excuse to learn more PowerShell |
Oh, yeah, I remember that thread @dahlbyk. In fact, I think it was @JayBazuzi's comments about designing something Task oriented and PowerShell friendly that made me think about creating something from scratch and made @jrich523 and I decide this was the right project idea to play with some notions of BDD and specifications on... Anyhow. I think I can close this, yes? |
Yeah, I think we're good 👍 I think I'll close it myself 😉 |
First: THANK YOU SO MUCH FOR THIS ❤️ I was just working on doing this myself when I found you!
Now as to my question: Why use LibGit2Sharp? In my prototyping I just called the git CLI. How the user got it on their machine I didn't care. Admittedly that means I have to do string parsing but it also means hooks will work.
The text was updated successfully, but these errors were encountered: