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

Commitd986a59

Browse files
authored
Merge pull request#1778 from stegm/fix_index_with_pathlike
Fix if items of Index is of type PathLike
2 parentsc398d79 +6e4cee4 commitd986a59

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎git/index/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def _items_to_rela_paths(
940940
foriteminitems:
941941
ifisinstance(item, (BaseIndexEntry, (Blob,Submodule))):
942942
paths.append(self._to_relative_path(item.path))
943-
elifisinstance(item,str):
943+
elifisinstance(item,(str,os.PathLike)):
944944
paths.append(self._to_relative_path(item))
945945
else:
946946
raiseTypeError("Invalid item type: %r"%item)

‎test/test_index.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,16 @@ def test_index_mutation(self, rw_repo):
558558
defmixed_iterator():
559559
count=0
560560
forentryinindex.entries.values():
561-
type_id=count%4
562-
iftype_id==0:# path
561+
type_id=count%5
562+
iftype_id==0:# path (str)
563563
yieldentry.path
564-
eliftype_id==1:# blob
564+
eliftype_id==1:# path (PathLike)
565+
yieldPath(entry.path)
566+
eliftype_id==2:# blob
565567
yieldBlob(rw_repo,entry.binsha,entry.mode,entry.path)
566-
eliftype_id==2:# BaseIndexEntry
568+
eliftype_id==3:# BaseIndexEntry
567569
yieldBaseIndexEntry(entry[:4])
568-
eliftype_id==3:# IndexEntry
570+
eliftype_id==4:# IndexEntry
569571
yieldentry
570572
else:
571573
raiseAssertionError("Invalid Type")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp