Skip to content

fix(effort, summary): count files with non-ASCII names - #1290

Merged
spacewander merged 2 commits into
tj:mainfrom
jayhemnani9910:fix/non-ascii-paths-effort-summary
Nov 25, 2026
Merged

spacewander merged 2 commits into
tj:mainfrom
jayhemnani9910:fix/non-ascii-paths-effort-summary

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

git effort leaves out files with non-ASCII names, and git summary --line counts no lines (and no author) for them. With the default core.quotepath, git ls-files prints ünï.txt as "\303\274n\303\257.txt", and that quoted name is passed on to git log and git blame, which find no such file.

Both commands now list files with git -c core.quotepath=off ls-files, so the names come through as they are.

Added tests/git-effort.bats and tests/git-summary.bats; both fail without the change. bats ./tests passes.

Comment thread bin/git-effort Outdated
save_ifs=$IFS
IFS=$(echo -en "\n\b")
paths=($(git ls-files))
paths=($(git -c core.quotepath=off ls-files))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we can use mapfile -d '' -t paths < <(git -c core.quotepath=off ls-files -z), so it works with newlines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 81a8d80: paths now come from mapfile -d '' -t paths < <(git ls-files -z). With -z git doesn't quote names, so core.quotepath isn't needed there. git-effort already needs bash 4.4 for ${nJobs@P}, so mapfile -d doesn't raise the floor. Added a test with a newline in a file name.

Comment thread bin/git-summary Outdated
#
lines() {
git ls-files -- "$@" | single_file
git -c core.quotepath=off ls-files -- "$@" | single_file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lines() now receives names from git ls-files -- "$@", but the output is read by single_file using while read -r data, which doesn't work with newline

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 81a8d80: lines() uses git ls-files -z and single_file reads with while IFS= read -r -d '' data, which also works on bash 4.0. Added a test that counts a file with a newline in its name.

@spacewander
spacewander merged commit 9f6632c into tj:main Nov 25, 2026
5 checks passed
@spacewander

Copy link
Copy Markdown
Collaborator

@jayhemnani9910
Merged. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants