Open zaquestion opened 3 years ago
+1 for using go-git (do you mean https://github.com/go-git/go-git, right?)! I'm not sure how better/faster it would be, but for sure it seems more suitable than calling git cli directly.
I think we should consider https://github.com/libgit2/git2go, as it is the library that Gitlab/Gitaly uses.
Oh, ok, that's interesting. This seems indeed the "officially supported" module for libgit2. However I think the goal of using go-git is to eliminate the need for any system executable/library dependency and since git2go is basically a set of bindings to libgit2 the C library itself is required. Using go-git would allow a single go build
to have everything up and running and I think go-git has everything we need for now (even though it's known it lacks a bunch of git-core features).
I'll keep this in mind in case I face a case where go-git doesn't offer an alternative.
Multiple reasons to do this, one is speed, running library functions instead of execing
git
showed noticeable speedups when I experimented with this change over last time. 2nd is that one of the main complaints aboutlab
is thatgit
is a dependency, since we have an opportunity to (almost) completely remove this dep and speedup the tool at the same time we should definitely take it.Some of the work has already been done on: https://github.com/zaquestion/lab/tree/go-git (this branch is pretty far behind now, so it'd need to be caught up and the work in
internal/git
completed.For good measure lets see if we can also record some of the perf improvements on the ticket for posterity, even if it's just "wow x feels faster", I do recall having those moments when I started the branch.
Ref: https://github.com/go-git/go-git