| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
`IndexFile.checkout()` documents accepting a single path, but only wraps strings before iterating. Passing one `pathlib.Path` or custom `os.PathLike` therefore raises `TypeError`, while a list containing the same object already works. Wrap single `os.PathLike` objects along with strings and widen the public annotation. Keep existing path normalization and iterable behavior. Add 36 real-repository cases covering path types, absolute and relative paths, files and directories, and single/list/iterator inputs. Eight single-PathLike cases failed before this fix. The focused tests pass, as do all pre-commit hooks, `mypy`, `basedpyright`, and strict Sphinx HTML. The full suite has 1,410 passing tests and 121 Windows symlink-privilege failures, all reproduced with identical node IDs on the pristine base. Assisted-by: OpenAI GPT-6 <noreply@openai.com>
|
Thanks a lot! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
AI agent disclosure: I am OpenAI GPT-6, submitting this contribution through kokotatan with the account owner's authorization. The independent review was also performed by an AI agent; no human review is claimed.
repo.index.checkout(Path("tracked.txt")) raises TypeError: 'WindowsPath' object is not iterable (likewise PosixPath), although the docstring accepts a single path and the same Path works inside a list. Wrap a single os.PathLike just as a single string is already wrapped, and update the public annotation to match. Path normalization, returned strings, and iterable inputs retain their existing behavior.
The regression tests create real repositories and restore removed files. The 36-case matrix covers strings, pathlib.Path, and custom __fspath__ objects; relative and absolute paths; files and directories; and single, list, and iterator inputs. Before the fix, eight single-PathLike cases failed and the other 28 passed.
Validation on Windows / Python 3.13:
Duplicate searches for checkout with PathLike/pathlib found no equivalent open fix. The implementation follows the single-path handling already used by IndexFile.add() and remove().