refactor(serve)!: remove JGit engine, make subprocess the only git backend#423
Merged
tinder-maxwellelliott merged 1 commit intoJul 10, 2026
Merged
Conversation
…ckend Make the native `git` subprocess (`ProcessGitClient`) the sole git engine for `bazel-diff serve` and remove the in-process JGit integration entirely. - Delete JGitClient, its test, and the SLF4J binding test (the slf4j-nop dep existed only to silence JGit's NOP-logger warning); drop the org.eclipse.jgit, slf4j-nop, and slf4j-api maven deps and repin maven_install.json. - Remove the `--gitEngine` flag; `createGitClient()` always returns ProcessGitClient. `/metrics` `gitEngine` now reports the literal "subprocess" (field kept so the JSON contract is stable). - Update serve_harness.py to drop the engine dimension (its cross-engine parity gates no longer apply); update README/template prose, the /metrics example, and the regenerated `serve --help` block. This also resolves the partial-clone checkout failure JGit 5.13 could not handle (it has no promisor/lazy-fetch): native git fetches the missing blobs at checkout. Validated: binary builds, the serve/server unit tests pass, and E2E `testServeEndToEnd` (real git repo, no `--gitEngine`) exercises the subprocess path end-to-end and passes. BREAKING CHANGE: the `--gitEngine` flag is removed and a `git` binary must now be on PATH. Invocations passing `--gitEngine=subprocess` should drop the flag; `--gitEngine=jgit` (the previous default) is no longer available. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Makes the native
gitsubprocess (ProcessGitClient) the only git engine forbazel-diff serveand removes the in-process JGit integration entirely, per request to "make subprocess the only option for now."This also resolves the pending partial-clone checkout failure JGit 5.13 could not handle — it has no promisor/lazy-fetch, so checking out a revision whose trees/blobs weren't materialized by the initial clone threw
JGit checkout … Missing unknown <sha>. Native git fetches those blobs on demand at checkout, so the previously-proposedJGitClient.checkout()fallback is now moot.Changes
JGitClient.kt,JGitClientTest.kt, andSlf4jBindingTest.kt(theslf4j-nopruntime dep existed only to silence JGit's NOP-logger warning).org.eclipse.jgit,slf4j-nop, andslf4j-apiMaven deps fromMODULE.bazel/cli/BUILDand repinnedmaven_install.json(−111 lines: jgit, JavaEWAH, both slf4j jars).--gitEngineflag;ServeCommand.createGitClient()now always returnsProcessGitClient. Updated the--gitPathhelp text (no longer conditioned on the removed flag)./metricsgitEnginenow reports the literal"subprocess". The field is intentionally kept so the metrics JSON contract stays stable (and is easy to re-expand if another engine returns).serve_harness.py: removed the engine dimension — the harness existed to assert cross-engine parity, which no longer applies. Cases are nowfull/full+deps/shallow/partial./metricsexample, and the regeneratedserve --helpblock.Validation
//cli:bazel-diffbuilds clean without JGit.ServeCommandTest,MetricsServiceTest,BazelDiffServerTest,GitClientTest,HashServiceTest,ImpactedTargetsServiceTest,CachePrunerTest,LocalDiskHashCacheStorageTest,StderrLoggerTest.E2ETest#testServeEndToEndpasses — it stands up a real git repo and runsservewith no--gitEngine, so it now exercises the subprocess (ProcessGitClient) path end-to-end (resolve/checkout + realbazel query+ distances + cache).ktfmtandbuildifierclean.E2ETestfailures (cquery/bzlmod/external-repo/Android) are the pre-existing sandbox environment issue (nested bazel can't reach the network / locate a JDK for coursier), not caused by this change.--gitEngineflag is removed. Invocations passing--gitEngine=subprocessshould drop the flag;--gitEngine=jgit(the previous default) is no longer available.gitbinary must now be onPATH(the old default JGit engine required none).Suggest a major version bump (→ 33.0.0) on release. If softer back-compat is preferred,
--gitEnginecould instead be kept as a hidden, deprecated no-op that accepts onlysubprocess— happy to add that.🤖 Generated with Claude Code