Fix file handling of --all-files to properly handle non-ascii filenames.
On my setup lintrunner was failing like this:
(py39) $ lintrunner --take RUFF --all-files
error: No such file or directory (os error 2)
The underlying error was because there's a file with non-ascii characters in the name.
There are two problems:
- When a file reported by
gitwasn't found it was reporting the error without any context about the filename. - The files being returned by
gitare escaped bygitand then passed through a utf-8String.
This PR adds context for the names so when an error does occur the user can at least tell what file had the problem.
Additionally it changes how --all-files gets its filenames so it doesn't pass them through String (which incorrectly does utf-8 encoding on them).
There are some additional incorrect handling of paths in other areas of the code (get_paths_from_cmd for example) which should probably be fixed in a similar manner in the future (or maybe merged with the all-files handling).
sorry for the late response—I ran the CI, mind taking a look at the issues?
@suo Huh. Looks like a bunch of the CI is failing with an infra issue:
Getting action download info
Error: This request has been automatically failed because it uses a deprecated version of `actions/upload-artifact: v3`. Learn more: https://github.blog/changelog/[20](https://github.com/suo/lintrunner/actions/runs/14915998547/job/41902324071?pr=86#step:1:24)24-04-16-deprecation-notice-v3-of-the-artifact-actions/
Can you give me permission to push to your branch? I want to try rebasing to see if that fixes things