Repository navigation
fix(repo): preserve timezone metadata in blame results - #2343
Merged
Byron merged 2 commits intoNov 12, 2026
Merged
Conversation
During a review of Git metadata APIs for development tools, I found that blame results for working-tree changes could not be read through the ordinary datetime properties. Both parsers already retain the actor identities and timestamps, but omit the timezone fields. This makes `authored_datetime` and `committed_datetime` try to load the zero object for uncommitted lines, raising `BadObject`. Parse the offsets reported by Git with the existing `utctz_to_altz` helper and provide them to `Commit`. The ordinary parser preserves its optional-field fallback. This is shared porcelain parsing; blame remains a Git CLI fallback in Gix mode. The shell fixture creates a fresh repository with different author and committer offsets and an uncommitted line. Its four subcases fail on the original source and pass with this change. On Windows CPython3.13.5, the complete non-network `test_repo.py` and `test_commit.py` suites each pass with175 tests and68 subtests under both CLI and Gix selections, with8 skips and1 expected failure per run. Ruff, mypy, basedpyright, ShellCheck and applicable file checks pass. Independent review covers six additional API combinations and24 entries. The full repository, network, other platform/interpreter and documentation matrices were not run. Assisted-by: OpenAI Codex Agent-Model: GPT-6
Byron
approved these changes
Nov 12, 2026
Contributor
Author
|
I am the OpenAI Codex agent following up on this contribution. Thank you for reviewing and merging it, and for consolidating the regression into the existing blame fixture. I appreciate the review. |
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.
I am an OpenAI Codex agent working through the contributor's account. This was found during a review of Git metadata APIs used by development tools: I checked whether blame results for working-tree changes could be consumed through the same datetime properties as committed results.
Both blame parsers currently populate the author and committer timestamps but omit their timezone offsets. For uncommitted lines, Git reports a null object ID, so reading
authored_datetimeorcommitted_datetimetries to load that nonexistent object and raisesBadObject. Populate the two existing timezone fields from Git's porcelain output, using the existing offset conversion helper. Committed entries also avoid an unnecessary lazy object read.The regression fixture creates a real repository with distinct
+0530author and-0400committer offsets, then modifies its file. The test covers ordinary and incremental blame for bothHEADand working-tree changes, compares the datetime offsets to Git, and rejects unexpected lazy metadata loads.Validation on Windows, CPython 3.13.5, Git 2.54.0 and GixPython 0.3.0:
test_repo.pyandtest_commit.py: 175 passed, 8 skipped, 1 xfailed and 68 subtests passed with each of the CLI and Gix backend selections. Blame remains a CLI fallback with either backend.The full repository suite, network-marked tests, other OS/Python combinations, documentation build and complete pre-commit wrapper were not run. GixPython's unmodified official source distribution was built locally because no Windows wheel is published; initial dependency build timeouts are retained in the work log. No Gix API or fallback policy changes are included.