Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JoinPathlike Object to Tree#2094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 3 commits intogitpython-developers:mainfromGeorge-Ogden:join-pathlike
Dec 15, 2025

Conversation

@George-Ogden
Copy link
Contributor

This extends theTree.join andTree.__truediv__ API to allow a pathlike object.
For example:

repo=Repo(my_local_repo)interesting_filepath:Path=Path(folder)/fileblob=repo.tree()/interesting_filepath

This did not work before without explicitly converting thePath to a string, but works now.

@Byron
Copy link
Member

Thanks a lot, this looks very good to me!

It's a bit sad that we have some test duplication to validate various types, but I guess it's better than not having them.
I will merge unless Copilot comes up with something more than nits that I can just apply.

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends theTree.join andTree.__truediv__ API to support pathlike objects (such aspathlib.Path), enabling more Pythonic path handling when traversing Git tree objects. Previously, users had to explicitly convertPath objects to strings; now they can use them directly with the/ operator.

  • Type annotations updated fromstr toPathLike for both methods
  • Implementation usesos.fspath() to convert PathLike objects to strings
  • Comprehensive test coverage added for PathLike support with various scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

FileDescription
git/objects/tree.pyUpdatedjoin() and__truediv__() methods to acceptPathLike parameters; addedos.fspath() conversion; importedos module
test/test_tree.pyAdded comprehensive test cases for string and PathLike path lookups covering simple, nested, folder, and invalid path scenarios; importedpytest,Repo, andPathLikeMock

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Rename blob to treeCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ByronByron merged commitb8bb60e intogitpython-developers:mainDec 15, 2025
27 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@George-Ogden@Byron

[8]ページ先頭

©2009-2025 Movatter.jp