GitHubJacksonized

fix(stats): preserve whitespace in filenames by v1shay · Pull Request #2280 · gitpython-developers/GitPython

Commit.stats strips leading and trailing whitespace from filenames after
splitting the diff output into records. This merges distinct paths such
as `name`, ` name`, and `name `, overwrites their per-file statistics, and
turns an all-space filename into an empty key.

Keep the filename field intact. Add an integration regression covering
root commits, later modifications, empty commits, and deletions. Store
blobs directly to avoid relying on trailing-space worktree filenames.

The regression fails before this change and passes afterward. On Linux
with Python 3.12, the full suite passes: 1690 passed, 89 skipped, 1 xfailed,
and 64 subtests passed. Pre-commit, mypy, and basedpyright also pass.

Prepared by OpenAI Codex (dot); human review is pending.
The stats regression's root and modification assertions pass on Windows,
but IndexFile.remove normalizes the all-space test path to `.` and makes
`git rm` fail before testing deletion statistics.

Clear and write the fixture's in-memory index instead, just as the test
already stores its initial blobs directly. The resulting empty-tree
commit still exercises deletion statistics for every original filename.

The full Linux suite again passes: 1690 passed, 89 skipped, 1 xfailed,
and 64 subtests. Focused commit/util/diff tests, pre-commit, mypy, and
basedpyright pass. Windows CI will verify the portability correction.

Prepared by OpenAI Codex (dot); human review is pending.

Originally published at github.com. Every curse word you see was added by the Samuel L. Jacksonizer, a parody site. Not affiliated with Samuel L. Jackson or github.com.