objects: decode a byte mode before reading its digits by SashaMIT · Pull Request #2261 · gitpython-developers/GitPython
Repository navigation
objects: decode a byte mode before reading its digits - #2261
Merged
Byron merged 1 commit into gitpython-developers:main from SashaMIT:decode-byte-mode Oct 1, 2026
Merged
objects: decode a byte mode before reading its digits #2261 Byron merged 1 commit into gitpython-developers:main from SashaMIT:decode-byte-mode
Conversation
SashaMIT commented Oct 1, 2026 · edited Loading
Copy link Copy Markdown
Contributor
Summary
mode_str_to_int(b"100644") returned 1830740 (0o6767524). A byte is an int, so the digit 4 was read as 52. mode_str_to_int("100644") was already 0o100644. A byte string is decoded before the digits are read. b"120000" is 0o120000. 644 is still 0o644.
Test plan
-
pytest -o addopts= test/test_util.py::test_mode_str_to_int_accepts_bytes(passed; on tip the byte mode was1830740)
Drafted with Grok 4.7. The code has not yet been reviewed by a human.
objects: decode a byte mode before reading its digits
62266da
mode_str_to_int(b"100644") returned 1830740. A byte is an int, so the digit 4 was read as 52. A text mode was already 0o100644.Byron requested a balanced review from Copilot October 1, 2026 12:05 Copilot started reviewing on behalf of Byron October 1, 2026 12:06
View session
Copilot PR reviewer Copilot
AI
reviewed Oct 1, 2026
View reviewed changes
Copilot
AI
left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Copilot review overview
🟢 Approval recommended
The focused fix correctly handles byte modes and includes adequate regression coverage.
Review effort: Balanced
Findings: None
Fixes byte-based Git mode parsing by decoding bytes before converting octal digits.
Changes:
- Decode byte modes as ASCII.
- Add regression coverage for string and byte modes.
| File | Description |
|---|---|
git/objects/util.py |
Corrects byte mode conversion. |
test/test_util.py |
Adds regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Byron commented Oct 1, 2026
Copy link Copy Markdown
Member
|
Thanks a lot! |
bda18e0
into
gitpython-developers : main
Oct 1, 2026
47 checks passed
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment