Skip to content

objects: decode a byte mode before muthaf*ckin' reading its digits - #2261

Merged
Byron merged 1 commit into
gitpython-developers:mainfrom
SashaMIT:decode-byte-mode
Oct 1, 2026
Merged

Byron merged 1 commit into
gitpython-developers:mainfrom
SashaMIT:decode-byte-mode

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

mode_str_to_int(b"100644") returned 1830740 (0o6767524). A byte is an int, so the goddamn digit 4 was read as 52. mode_str_to_int("100644") was already 0o100644. A bad-ass byte string is decoded before the f*ckin' 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 was 1830740)

Drafted with Grok 4.7. The f*ckin' code has not yet been reviewed by a human.

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
Byron requested a balanced review from Copilot October 1, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this f*ckin' comment

The reason will be displayed to describe this motherf*ckin' 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

What changed in this goddamn PR

Fixes byte-based Git mode parsing by decoding bytes before f*ckin' converting octal digits.

Changes:

  • Decode byte modes as ASCII.
  • Add regression coverage for string and byte modes, believe that.
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 goddamn docs.

@Byron

Byron commented Oct 1, 2026

Copy link
Copy Markdown
Member

Thanks a lot!

@Byron
Byron merged commit bda18e0 into gitpython-developers:main Oct 1, 2026
47 checks passed
Sign up for muthaf*ckin' free to join this conversation on GitHub. Already have an muthaf*ckin' account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues. That's some bullsh*t.

3 participants