Skip to content

Bind LGit callbacks to LGitLibrary - #125

Open
guillep wants to merge 1 commit into
pharo-vcs:Pharo15from
guillep:lgit-callback-library
Open

guillep wants to merge 1 commit into
pharo-vcs:Pharo15from
guillep:lgit-callback-library

Conversation

@guillep

@guillep guillep commented Oct 30, 2026

Copy link
Copy Markdown
Member

This PR binds LGit callbacks to LGitLibrary, so they always use the same runner as the calls that trigger them.

Goal

Callbacks created without a library fall back to the 'default' library and its same-thread runner. This is harmless while LGitLibrary is on the same-thread runner, but with a TFWorker libgit2 calls them from the worker thread and crashes the VM. A clone crashed twice this way, and with this fix a clone, a fetch, error reads and a semaphore wait inside a callback all worked on a worker. This is a first step for running libgit2 without blocking the image, so Iceberg can show progress during a fetch.

Main changes

  • Added LGitCallback>>ffiLibraryName, answering LGitLibrary. Being on the instance side, it covers every way of creating a callback, including the signature:block: overrides and Iceberg's progress classes.
  • Added LGitLibraryTest>>testCallbacksUseLGitLibrary.

The default runner does not change. The fix needs nothing new from Pharo, so it can also be backported to Pharo14. Related Pharo change: pharo-project/pharo#20136.

Tests

LibGit-Tests: 125 ran, 122 passed, 3 failures, 12 of the passes skipped. The failures are LGitFreshRepositoryTest>>#testAutoRelease, LGitStringArrayTest>>#testAutoRelease and LGitBlobTest>>#testFree, and they also fail without this change. The new test passes. In Iceberg-Tests, IceNewGitRepositoryTest, IceGitMergeTest and IceSinglePackageLocalGitRepositoryTest pass (131 ran, 14 skipped). The full package run timed out, and the manual network tests are skipped.

🤖 Generated with Claude Code

Callbacks fell back to the default library and its same-thread runner. If LGitLibrary used a TFWorker, libgit2 called them from the worker thread and crashed the VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant