Repository navigation
Conversation
Co-authored-by: CenFangyu <[email protected]>
Co-authored-by: CenFangyu <[email protected]>
|
Verified this on Windows, where the crash lives — thanks for picking it up. The crash-to-usage-error conversion works: >>> from black.files import find_project_root
>>> find_project_root(("C:/work/app/a.py", "D:/tmp/b.py"), None)
UsageError: Sources on different drives share no common project root.One gap against the requirement @cobaltt7 stated for this route ("passing There's also a second consumer of the root that either route needs to deal with for formatting to continue: I've opened #5386 implementing the other route from cobaltt7's comment (treat it as no config found, warn, use defaults), with a per-source-root fallback that covers both points — feel free to use whatever parts of it are useful, or close it if the error route is preferred and this PR gets amended instead. Happy to test any revision on Windows. |
|
Superseded by #5386. |
Description
Fixes #5379.
find_project_rootpassed an empty parent-path intersection tomax(), which raisesValueErrorwhen sources live on different Windows drives. It now raisesclick.UsageErrorinstead. Same-drive and POSIX paths that share a parent are unchanged.Checklist - did you ...
--previewstyle, following the stability policy?CHANGES.mdif necessary?