Repository navigation
Update the Gix backend to GixPython 0.4.0 - #2361
Conversation
The published GixPython 0.3.0 wheel loses time zone offsets when an identity line has trailing fields and misclassifies a `140000` gitlink. It also accepts malformed `.gitmodules` settings that Git rejects. Pin both extras to GixPython 0.4.0, which includes the Gitoxide 0.91.0 fixes, and document the Rust 1.95 minimum for source builds. Use the structured commit and tag dates when they match the date at the start of the raw header suffix. GixPython 0.4.0 still reads a short `+020` offset as UTC, so keep the existing CLI fallback for mismatched dates. Format native tree entry kinds as Git's canonical `ls-tree` modes while Gitoxide continues to expose the raw modes. Keep existing fallbacks for invalid or unsupported data. Verified the published macOS arm64 wheel against Git 2.54.0. Git's `split_ident_line()` and `canon_mode()` describe the display behavior. Nine focused checks failed with 0.3.0, and all 13 focused checks passed with 0.4.0, including reftable fallback coverage. Verified both package extras, Ruff lint and format, mypy, and basedpyright. The focused deserialization suite passed on both backends with the short-offset test. Agent-Model: unknown
GixPython 0.4.0 resolves `HEAD@{never}` to the oldest reflog entry,
where Git 2.54 rejects the date. The two engines also select different
entries for `HEAD@{2days3hours}`. Use the shared revision guard so both
native resolution paths fall back to Git for textual date selectors.
The reflog fixture checks an invalid and a valid textual date alongside
ordinary selectors. The full revision test file passed on both backends.
Agent-Model: unknown
Git 2.54's raw diff ignores a file that is only untracked inside an embedded gitlink without a .gitmodules entry. GixPython 0.4.0 reports that checkout as dirty. The native submodule status identifies embedded repositories, so use the existing Git path when one is reported modified. Let Git apply the diff ignore policy. The status tests verify untracked and tracked checkout changes for both object formats, alongside the existing configured submodule and worktree cases. All ten focused checks passed with Gix. Agent-Model: unknown
GixPython 0.4.0 decodes a missing mode and a literal zero as the same gitlink. Git 2.54 rejects the missing mode but accepts the literal zero. Send native zero modes through Git before formatting tree entries so malformed input raises the Git diagnostic. The tree fixture covers both spellings and both object formats. The focused native tree and object tests passed. Agent-Model: unknown
Git 2.54 parses only unsigned timestamp digits in an identity. The GixPython 0.4.0 accessor can return a negative timestamp and a nonzero offset from a header with trailing fields. Use the existing CLI fallback for negative native timestamps so object properties keep the established zero date and offset. The deserialization suite passed on both backends, including author, committer and tagger checks for the negative timestamp. Agent-Model: unknown
Git 2.54 preserves the spaces inside a stored email address. GixPython 0.4.0 trims those spaces in its commit author and committer accessors. The accepted trailing-date prefix exposed that difference. Check the native identity against the raw header and retain the existing CLI path when the comparison fails. The regression covers author and committer whitespace and verifies that the native tagger already preserves it. The commit test file passed on both backends. Agent-Model: unknown
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
The guard checks only the first selector, allowing chained selectors such as main@{upstream}@{never} to reach native parsing and potentially return the oldest commit instead of Git’s rejection.
1 open issue
What changed in this PR
GitHub Copilot reviewed this update to GitPython’s optional Gix backend. It adopts GixPython 0.4.0’s upstream fixes while retaining Git CLI fallbacks for remaining compatibility differences.
Changes:
- Pin GixPython 0.4.0 and document the Rust 1.95 source-build requirement.
- Update native tree formatting and compatibility guards for revisions, signatures, and embedded repositories.
- Add regression fixtures and tests, and update the backend compatibility ledger.
| File | Description |
|---|---|
tests/fixtures/tree-modes.sh |
Create noncanonical and ambiguous tree-mode fixtures. |
tests/fixtures/submodule-rejected-lines.sh |
Create malformed submodule configuration fixtures. |
tests/fixtures/gix-backend.sh |
Add embedded-repository dirtiness scenarios. |
tests/fixtures/commit.sh |
Add signature date and email edge cases. |
test/test_rev_parse.py |
Check textual reflog selector fallbacks. |
test/test_gix_backend.py |
Test tree modes, configuration rejection, and dirty checks. |
test/test_commit.py |
Verify signature preservation and date fallbacks. |
test-requirements.txt |
Pin the test dependency to GixPython 0.4.0. |
README.md |
Update installation and source-build requirements. |
gix-requirements.txt |
Pin the backend dependency to GixPython 0.4.0. |
git/_backend.py |
Adjust native formatting and CLI fallback guards. |
doc/gix-backend.md |
Record validation, upstream fixes, and remaining differences. |
.github/workflows/pythonpackage.yml |
Update the Rust requirement comment; execution is unchanged. |
Review effort: Balanced

Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Pin the
gixandtestextras to GixPython 0.4.0. The published release brings the Gitoxide fixes for signature dates followed by trailing fields, unusual gitlink modes, and malformed.gitmodulessettings to installations that use the PyPI package.Keep the Git CLI path for cases where GixPython 0.4.0 still differs from Git 2.54. That covers textual reflog dates, dirty checks for embedded repositories, ambiguous zero tree modes, negative identity timestamps, and stored identity text changed by native decoding.
Context
The previous 0.3.0 pin could lose nonzero time zone offsets, misclassify gitlinks, and accept submodule configuration Git rejects. The new pin makes the upstream fixes available to users of the extras and raises the Rust minimum for source builds to 1.95.
The five review findings are handled in separate commits. The backend ledger records each remaining mismatch, how to reproduce it, and where GitPython uses the existing CLI path.
Validation
git diff --checkpassed.