fix: allow merge-base with an absent objects/info directory - #2979
Merged
Conversation
) <!-- agent --> An absent `.git/objects/info` directory made `Graph::at()` return an error without its filesystem cause. The optional-cache fallback in `Repository::commit_graph_if_enabled()` could not recognize `NotFound`, so operations such as `merge_base(HEAD, HEAD)` failed despite having all required commit objects. Inspect the path with one fallible metadata read and preserve its I/O error in the chain. Missing paths now reach the existing fallback, while other metadata failures remain distinguishable. Cover the error source and merge-base behavior with an empty and then absent `objects/info`. Both regression tests failed before the fix. Git reference: `commit-graph.c` at `1630431f326e15fcde608827b5ff38422528eb59` uses `open_commit_graph()`, `load_commit_graph_one()`, and `prepare_commit_graph()` to fall back when no graph can be opened. With Git 2.50.1 (Apple Git-155), `git -c core.commitGraph=true merge-base` returns the expected commits for `HEAD HEAD` and `HEAD HEAD^` with either an empty or an absent `objects/info` directory. Assisted-by: GPT 6.0 Co-authored-by: GPT 6.0 <codex@openai.com>
Sebastian Thiel (Byron)
force-pushed
the
absent-objects-info-dir-fix
branch
from
September 8, 2026 10:16
c950841 to
72f3e8f
Compare
Sebastian Thiel (Byron)
marked this pull request as ready for review
September 8, 2026 10:20
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex GPT-6.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #2978.
Repository::merge_base()now succeeds when the optional.git/objects/infodirectory is absent. The sharedgix-commitgraphloader reads path metadata once and preserves its filesystem error, allowing the existing optional-cache fallback to recognizeNotFound. Other metadata failures retain their underlying cause.Regression tests cover the missing-path error source, empty and absent
objects/infodirectories, and merge-base lookup for both identical commits and a commit with its parent.Validation
--no-default-features --features sha1,revision.cargo nextest run --locked -p gix -p gix-commitgraph --no-fail-fast, withGIX_TEST_IGNORE_ARCHIVES=1and separate SHA-1/SHA-256 fixture runs: 457 tests passed in each run.cargo clippy --locked -p gix -p gix-commitgraph --all-targets -- -D warnings -A unknown-lints --no-depscargo fmt --all -- --checkc9508418ebcompleted with no findings.Git 2.50.1 (Apple Git-155) returns the expected merge bases for
HEAD HEADandHEAD HEAD^with either an empty or absentobjects/info. Git'scommit-graph.cat1630431f326e15fcde608827b5ff38422528eb59likewise falls back when no commit-graph can be opened.