chore: drop optional libgit2 dependency (keep git log fallback)#865
Merged
Conversation
libgit2 is licensed GPLv2-with-linking-exception, and this project is
deliberately GPL-free (see scripts/license-policy.json). libgit2 was only
an OPTIONAL, faster git-history code path guarded by HAVE_LIBGIT2 and
auto-detected via pkg-config; it always shipped with a popen("git log ...")
fallback that release binaries already used (they were built without
libgit2). Making that popen fallback the SOLE git-history implementation
means there is NO change to shipped behavior.
Changes:
- pass_githistory.c: collapse the HAVE_LIBGIT2 #ifdef so only the popen
parse_git_log remains; drop the now-unused <git2.h>/<time.h> includes.
- cbm.c / cbm.h / main.c / subprocess.c / index_supervisor.h: remove the
libgit2 mimalloc allocator bind and its >=1.7.0 version guards; keep the
tree-sitter + sqlite3 binds; correct the comments.
- Makefile.cbm: remove the optional-libgit2 pkg-config detection block,
the REQUIRE_LIBGIT2 error gate, and all LIBGIT2 CFLAGS/LIBS/FLAGS.
- .github/workflows/_test.yml: drop the REQUIRE_LIBGIT2 test-matrix leg
plus its libgit2-dev/pkg-config apt install (lower CI cost, no new
gating, no trigger change).
- flake.nix: drop libgit2/pkg-config from the dev shell (now-dead dep).
HAVE_LIBGIT2 no longer exists anywhere in the tree.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.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
Removes the optional libgit2 dependency entirely. The
git logpopenfallback — which release binaries already used — becomes the sole
git-history implementation.
HAVE_LIBGIT2no longer exists anywhere inthe tree.
Why
libgit2 is licensed GPLv2-with-linking-exception, and this project is
deliberately GPL-free (see
scripts/license-policy.json). libgit2 wasonly a faster git-history path, auto-detected via pkg-config and guarded
by
HAVE_LIBGIT2, always sitting behind apopen("git log ...")fallback.Release binaries are built without libgit2, so they already ran the
fallback — meaning there is no change to shipped behavior.
Files touched
src/pipeline/pass_githistory.c— collapse theHAVE_LIBGIT2#ifdefso only the popen
parse_git_logremains; drop the now-unused<git2.h>/<time.h>includes.internal/cbm/cbm.c,internal/cbm/cbm.h,src/main.c,src/foundation/subprocess.c,src/mcp/index_supervisor.h— remove thelibgit2 mimalloc allocator bind + its
>=1.7.0version guards; keep thetree-sitter + sqlite3 binds; correct the comments.
Makefile.cbm— remove the optional-libgit2 pkg-config detection block,the
REQUIRE_LIBGIT2error gate, and allLIBGIT2CFLAGS/LIBS/FLAGS..github/workflows/_test.yml— drop theREQUIRE_LIBGIT2test-matrixleg and its
libgit2-dev/pkg-configapt install.flake.nix— droplibgit2/pkg-configfrom the dev shell (dead dep).scripts/security-allowlist.txt— comment now says "git log" instead of"fallback when libgit2 not available".
Tradeoff
A local dev build that had libgit2 installed loses the (slightly faster)
libgit2 history path. Release binaries are unaffected — they never linked
libgit2.
CI-sensitivity note
Edits
.github/workflows/_test.yml: removes oneREQUIRE_LIBGIT2matrixleg and its apt install → lower CI cost. No new gating jobs, no
2x/UI-build cost, no trigger-scope change.
Verification
grepforlibgit2|HAVE_LIBGIT2|LIBGIT2|git_libgit2|git_allocator|git2across
src/ internal/ Makefile.cbm .github/: empty (only thehistorical
tests/windows/RED_TEST_ANALYSIS.mdanalysis doc stillmentions it, intentionally left untouched).
make -f Makefile.cbm cbm): clean, no warnings;compile lines contain no
-DHAVE_LIBGIT2; link line has no libgit2 libs.make -f Makefile.cbm build/c/test-runner): clean.test-runner pipeline: 215 passed — all 9githistory_*tests green.test-runner integration git_context: 27 passed.pass.done pass=githistory commits=3 edges=1— the popenparse_git_logparses real history and produces the FILE_CHANGES_WITH coupling edge.
Merge as a merge commit (not squash).