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

Fix if items of Index is of type PathLike#1778

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
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletiongit/index/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -940,7 +940,7 @@ def _items_to_rela_paths(
for item in items:
if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
paths.append(self._to_relative_path(item.path))
elif isinstance(item, str):
elif isinstance(item,(str, os.PathLike)):
paths.append(self._to_relative_path(item))
else:
raise TypeError("Invalid item type: %r" % item)
Expand Down
12 changes: 7 additions & 5 deletionstest/test_index.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -558,14 +558,16 @@ def test_index_mutation(self, rw_repo):
def mixed_iterator():
count = 0
for entry in index.entries.values():
type_id = count %4
if type_id == 0: # path
type_id = count %5
if type_id == 0: # path (str)
yield entry.path
elif type_id == 1: # blob
elif type_id == 1: # path (PathLike)
yield Path(entry.path)
elif type_id == 2: # blob
yield Blob(rw_repo, entry.binsha, entry.mode, entry.path)
elif type_id ==2: # BaseIndexEntry
elif type_id ==3: # BaseIndexEntry
yield BaseIndexEntry(entry[:4])
elif type_id ==3: # IndexEntry
elif type_id ==4: # IndexEntry
yield entry
else:
raise AssertionError("Invalid Type")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp