Description
There has been a latent sentiment amongst contributors that jj
has outgrown its need to depend on libgit2
, and as such we are moving to replace it and eventually deprecate it. This issue tracks the reasoning for this move, as well as the steps needed to make it happen and a deprecation plan.
Steps
- Implement shelling out to a git subprocess for
push/fetch
. git: spawn a separate git process for network operations #5228 - Migrate remote operations with
gitoxide
. - Migrate git tests to
gitoxide
cli/tests: move a lot of the cli tests to gitoxide #5575 #5639 lib/tests: port lib tests to gitoxide #5757 cli/tests: move bookmark_command test to gitoxide #5754 cli/tests: migrate more tests fromgit2
togitoxide
#5655 - Barricade the
git2
code behind a (enabled by default) feature flag - Switch the default
push/fetch
code path to use thegit
subprocess git: enable subprocessing by default #5652 - Enable a deprecation warning for
git2
- Remove
git2
Rationale
Issues with git2
libgit2
(with git2
being its Rust bindings) is a project to implement git
as a library so that external applications can interact programmatically with git
repos without having to shell out to git and parse its output.
This effort is commendable and git2
has been crucial in making jj
git compatible from the get go. I'd like to emphasize that this is by now means a bash on libgit2
. However, we have found some pain points with its usage:
- Missing support for
SSH
. This regularly comes up when users try to push to Github, with over 20 issues opened about it forjj
plus multiple reports a week. - Packaging problems.
libgit2
only supports one version at a time, meaning packagers have a problematic window of time whilejj
has not updated thegit2
to its latest version - Performance. For the main (current) usage of
libgit2
, which is interacting withgit
remotes,libgit2
has been reported to be slow
Change to what
jj
actually uses another git
library to interact with repositories: gitoxide
. This means that, as it stands, we have two libraries for interacting with git
, which is arguably one too many.
As gitoxide
has become more feature complete, relying on git2
becomes less desirable.
For the remaining cases (which turn out to be simply the push
/fetch
operations), the consensus is to rely on shelling out to a git
subprocess.
Activity