Repository navigation
fix: count files whose names ls-files would trim, quote, or blame would parse as options - #1
Merged
Merged
Conversation
Nitjsefnie
force-pushed
the
nul-safe-paths
branch
from
November 12, 2026 12:16
db521a2 to
e0db2cb
Compare
…ld parse as options List tracked and text files NUL-separated, so a leading space on the first name or a trailing space on the last survives, and names Git C-quotes (a quote, a backslash, a control character) are blamed under their real name. Pass `--` before the path to `git blame`, so a name starting with `-` is not read as an option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nitjsefnie
force-pushed
the
nul-safe-paths
branch
from
November 12, 2026 12:30
e0db2cb to
258dbd8
Compare
Coverage Report for CI Build 43218597853Coverage at 92.888% (no base build to compare)Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Nitjsefnie
marked this pull request as ready for review
November 12, 2026 14:48
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.
Summary
git famedropped files whose names start with-, start or end with a space, or that Git C-quotes, so its totals undercounted any repository holding one; this lists files NUL-separated and passes--before the path togit blame.Related Issues and Pull Requests
Relates to Nitjsefnie/gh-widgets#285
Changes
gitfame/_gitfame.py_get_auth_stats:git ls-files -zandgit grep -I --name-only -zreplace the newline split and.strip(), which trimmed a leading space from the first listed name and a trailing space from the last, and kept Git's C-quoting on names holding a quote, a backslash or a control character, so those names never matched a real path.gitfame/_gitfame.pyblame_file:git blame ... <branch> -- <fname>, so a name starting with-is a path rather than an option.tests/test_gitfame.pytest_awkward_names_loc: a repository of two-line files namedmiddle-safe.txtand-dash.txt, plus on POSIXleading.txt,trailing.txt,a"b.txt,a\b.txtand a tab-holding name, must total two lines per file and count every file.Testing
pytest -q -p no:cacheprovider --no-cov tests(Python 3.13, Linux) on258dbd8, this change rebased ontod793b35:54 passed in 2.34s.cmpagainst the saved copy,git status --shortshowing only the two edited files):--dropped:assert (12, 6) == (14, 7), failed.ls-filesback to the newline split:assert (4, 2) == (14, 7), failed.grepback to the newline split:assert (6, 3) == (14, 7), failed.258dbd8: theciworkflow's Ubuntu 3.8 (ubuntu-24.04) and 3.14, macOS 3.14 and Windows 3.14 cells all pass (this repository'stestjob skips pull requests opened by the owner, so the push run is the CI).Follow-ups / Known Limitations
--numstatpath (--locother thansurv) still reads newline-separatedgit logoutput; it is unchanged here.Footer
Generated by Claude Opus 5.5 (implementation, testing)