Skip to content

build: update libgit2 to 1.9.4 - #98

Open
chirino wants to merge 1 commit into
gitx:masterfrom
chirino:build/update-libgit2-to-1-9-4
Open

build: update libgit2 to 1.9.4#98
chirino wants to merge 1 commit into
gitx:masterfrom
chirino:build/update-libgit2-to-1-9-4

Conversation

@chirino

@chirino chirino commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Update ObjectiveGit from libgit2 0.28.5 to 1.9.4 and migrate the wrapper to current libgit2 APIs. Preserve SSH transport support in the framework build.

Changes

  • Update the libgit2 submodule and modernize buffer, OID, credential, and header usage
  • Disable unnecessary libgit2 test and CLI targets while explicitly enabling libssh2

Migrate ObjectiveGit to the current libgit2 APIs and retain SSH transport support.

Signed-off-by: Hiram Chirino <[email protected]>
@chirino
chirino marked this pull request as ready for review July 17, 2026 16:54
@goneng

goneng commented Aug 21, 2026

Copy link
Copy Markdown

I gave this a try against GitX itself, since CI here builds the framework
but not the app that consumes it. It holds up, with one small change needed
downstream.

What I ran

Checked this branch out with External/libgit2 at v1.9.4 (f7164261c),
built it with script/update_libgit2 as changed here, then built GitX
against the resulting framework.

  • GitX builds clean, 0 errors
  • GitX's unit suite passes, 39 tests

To be precise about how far that goes: it is compile plus unit tests.
I did not exercise fetch, push, clone or the credential paths at runtime,
and I did not run ObjectiveGit's own test suite.
So "builds and unit tests pass" rather than end-to-end validation.

One change needed on the GitX side

GitX has exactly one line that does not compile against libgit2 1.x.
Classes/git/PBRepositoryFinder.m reads git_buf.asize, which 1.x renamed
to reserved.

That turned out to be a pre-existing GitX bug rather than anything this PR causes.
asize is the allocated capacity, not the length of the path written into the buffer,
so the copy was taking in whatever followed the path in that allocation.
Fixed in gitx/gitx#582, which also adds the first tests for that file.
Nothing else in GitX needed touching.

That fix is independent of this PR and safe against the current libgit2 0.28.5 as well,
so it can land on its own. It is the submodule pointer bump in gitx/gitx that needs to
come after both.

One review point

In GTCredential.m both error paths lose their diagnostic strings:

-		git_error_set_str(GIT_EUSER, "No GTCredentialProvider set, but authentication was requested.");
-		return GIT_ERROR;
+		return GIT_EAUTH;

GIT_EAUTH looks like the more accurate return code.
But GitX surfaces libgit2's error message to the user, so dropping the text
makes a failed authentication harder to diagnose from the UI.
If keeping the messages is wanted, git_error_set_str is still available in 1.9.4 from
git2/sys/errors.h, where it moved and now returns int.

The rest reads well to me. Migrating to GIT_OID_SHA1_HEXSIZE,
git_oid_is_zero and GIT_BUF_INIT rather than leaning on
git2/deprecated.h is the right call, and the BUILD_CLAR to BUILD_TESTS
fix is a nice catch, since the old name was silently ignored and the whole
libgit2 test suite was being compiled on every build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants