GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(stats): preserve whitespace in filenames by v1shay · Pull Request #2280 · gitpython-developers/GitPython

Conversation

@v1shay

@v1shay v1shay commented Oct 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Commit.stats strips leading and trailing spaces from filenames, so distinct paths such as name, name, and name overwrite each other's per-file statistics. An all-space filename becomes an empty dictionary key. Git's --numstat output preserves these spaces; record newlines have already been removed by splitlines().

This keeps the filename field intact. The regression builds five distinct paths directly from blobs/index entries, then checks root commits, subsequent modifications, an empty commit, and deletions. This avoids creating trailing-space filenames in the working tree.

Verification

  • New regression fails on current main (804bc807) and passes with this change
  • Full suite on Linux, Python 3.12.14, Git 2.52.0: 1690 passed, 89 skipped, 1 xfailed, 64 subtests passed
  • pre-commit run --files git/util.py test/test_commit.py: passed
  • mypy git/ test/deprecation/ test/test_typing.py: passed
  • basedpyright: passed
  • git diff --check: passed

Tab/newline filename quoting is unchanged. CI on 963ca1c7 now passes all 47 jobs across all five workflows, including Windows, macOS, Ubuntu, Cygwin, Alpine, lint, and dependency checks. The previously failing Alpine network-dependent clone test passed on rerun; no source change was needed.

Rechecked on 2026-10-12: upstream main remains 804bc807 and still strips filename whitespace. No matching superseding fix was found among recent PRs or stats/whitespace searches. The earlier Git 3 migration PRs #2262 and #2273 are closed without merging. The focused commit-stats tests also pass locally (2 passed).

This PR was prepared and submitted by OpenAI Codex (dot), an AI agent operating through v1shay's account. Human review is pending.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
v1shay added 2 commits October 10, 2026 23:38
@v1shay
fix(stats): preserve whitespace in filenames
3e9611b
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.
@v1shay
test(stats): avoid normalizing fixture paths on Windows
963ca1c
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.
@Byron
Byron requested a balanced review from Copilot October 12, 2026 04:16
@Byron
Byron marked this pull request as ready for review October 12, 2026 04:16
Copilot started reviewing on behalf of Byron October 12, 2026 04:17
View session
Copilot AI reviewed Oct 12, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted fix is correct and thoroughly covered by regression tests.

0 open findings

What changed in this PR

Preserves leading and trailing whitespace in filenames reported by Commit.stats.

Changes:

  • Stops stripping filename whitespace during statistics parsing.
  • Adds regression coverage for additions, modifications, empty commits, and deletions.
File Description
git/​util.py Retains filenames exactly when building per-file statistics.
test/​test_commit.py Tests distinct whitespace-sensitive filenames across commit operations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron
Byron merged commit e296473 into gitpython-developers:main Oct 12, 2026
47 of 48 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@v1shay @Byron
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.