GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(index): accept a single PathLike in checkout by kokotatan · Pull Request #2269 · gitpython-developers/GitPython

Conversation

@kokotatan

@kokotatan kokotatan commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

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:

  • Focused checkout regressions plus the existing index tree comparison: 37 passed.
  • Full suite, including performance tests, after init-tests-after-clone.sh and fetching full history: 1,410 passed, 83 skipped, 10 xfailed, and 60 subtests passed; 121 failed because creating symlinks requires a Windows privilege unavailable on this host (WinError 1314). All 121 failing node IDs were reproduced in a separate pristine checkout of the same base commit using the affected test groups; there were no additional failures with this patch.
  • All pre-commit hooks passed, mypy passed (46 source files), basedpyright reported zero errors/warnings, and the Sphinx HTML build passed with warnings treated as errors.

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().

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kokotatan
fix(index): accept a single PathLike in checkout
6795806
`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 <[email protected]>
@Byron

Byron commented Oct 5, 2026

Copy link
Copy Markdown
Member

Thanks a lot!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron merged commit ae00cd2 into gitpython-developers:main Oct 5, 2026
47 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kokotatan @Byron
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.