Skip to content

Commit

Permalink
git_backend: replace git2::Repository with gix::Repository
Browse files Browse the repository at this point in the history
My gut feeling is that gitoxide aims to be more transparent than libgit2. We'll
need to know more about the underlying Git data model.

Random comments on gix API:

 * gix::Repository provides API similar to git2::Repository, but has less
   "convenient" functions. For example, we need to use .find_object() +
   .try_to/into_<kind>() instead of .find_<kind>().
 * gix::Object, Blob, etc. own raw data as bytes. gix::object and gix::objs
   types provide high-level views on such data.
 * Tree building is pretty low-level compared to git2.
 * gix leverages bstr (i.e. bytes) extensively.

It's probably not difficult to migrate git::import/export_refs(). It might
help eliminate the startup overhead of libssl initialization. The gix-based
GitBackend appears to be a bit faster, but that wouldn't practically matter.

martinvonz#2316
  • Loading branch information
yuja committed Oct 31, 2023
1 parent 58e6a2d commit e6dd022
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 196 deletions.
2 changes: 1 addition & 1 deletion cli/tests/test_edit_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn test_edit_current_wc_commit_missing() {
.assert()
.code(255);
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
Internal error: Failed to edit a commit: Current working-copy commit not found: Object 69542c1984c1f9d91f7c6c9c9e6941782c944bd9 of type commit not found: object not found - no match for id (69542c1984c1f9d91f7c6c9c9e6941782c944bd9); class=Odb (9); code=NotFound (-3)
Internal error: Failed to edit a commit: Current working-copy commit not found: Object 69542c1984c1f9d91f7c6c9c9e6941782c944bd9 of type commit not found: An object with id 69542c1984c1f9d91f7c6c9c9e6941782c944bd9 could not be found
"###);
}

Expand Down
Loading

0 comments on commit e6dd022

Please sign in to comment.