The other day I was trying to work with git LFS. I was very surprised to find out git-lfs, as in the binary, CLI application is the <i>only</i> (open) implementation in existence. There is nothing else. And even it itself does not offer itself up as a library; so even native Go code (the implementation language) has to fall back to shelling out to the CLI git extension! Not even bindings are possible. Such a painful loss of interoperability: IPC via return codes and parsing stdout/stderr.<p>It seems a similar story with the rest of git. I have hopes for gitoxide aka gix, and think the approach of library-first is correct going into the future. A CLI is then simply a thin wrapper around it, mapping argv to library operations basically.
Personally I soldiered on to to the point of being able to extract objects from packfiles, before I realised just how monstrously and tediously complex `git rev-parse` is, and gave up. It's foundational to pretty much every porcelain command, so it's not really something you can leave out if you want a semi-functioning `git`. See <a href="https://git-scm.com/docs/git-rev-parse#_specifying_revisions" rel="nofollow noreferrer">https://git-scm.com/docs/git-rev-parse#_specifying_revisions</a> and <a href="https://github.com/git/git/blob/ee48e70a829d1fa2da82f14787051ad8e7c45b71/refs.c#L732">https://github.com/git/git/blob/ee48e70a829d1fa2da82f1478705...</a> ; `git` really is an edifice.
I have been wanting something like this, but with a few more features such as "git diff". I took a crack at it, but the popular (and maybe only) Go Git implementation has some issues:<p><a href="https://github.com/go-git/go-git/issues/700">https://github.com/go-git/go-git/issues/700</a>
>The verbosity of Go’s error handling has been much-maligned. It’s simple and explicit, but every call to a function that may fail takes an additional three lines of code to handle the error<p>Putting error nil checks into a function is an anti-pattern in Go. There is no need to worry about the LOC count of your error checking code.<p>inb4 this ends up on pcj