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

Commit2ea528e

Browse files
committed
Fix typing of index.fun.write_tree_from_cache()
1 parent09053c5 commit2ea528e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

‎git/index/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def write_tree(self) -> Tree:
572572
# note: additional deserialization could be saved if write_tree_from_cache
573573
# would return sorted tree entries
574574
root_tree=Tree(self.repo,binsha,path='')
575-
root_tree._cache=tree_items# type: ignore
575+
root_tree._cache=tree_items# type: ignore # should this be encoded to [bytes, int, str]?
576576
returnroot_tree
577577

578578
def_process_diff_args(self,# type: ignore[override]

‎git/index/fun.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def read_cache(stream: IO[bytes]) -> Tuple[int, Dict[Tuple[PathLike, int], 'Inde
249249

250250

251251
defwrite_tree_from_cache(entries:List[IndexEntry],odb,sl:slice,si:int=0
252-
)->Tuple[bytes,List[Tuple[str,int,str]]]:
252+
)->Tuple[bytes,List[Tuple[bytes,int,str]]]:
253253
"""Create a tree from the given sorted list of entries and put the respective
254254
trees into the given object database
255255
@@ -298,12 +298,11 @@ def write_tree_from_cache(entries: List[IndexEntry], odb, sl: slice, si: int = 0
298298

299299
# finally create the tree
300300
sio=BytesIO()
301-
tree_to_stream(tree_items,sio.write)# converts bytes of each item[0] to str
302-
tree_items_stringified=cast(List[Tuple[str,int,str]],tree_items)
301+
tree_to_stream(tree_items,sio.write)# writes to stream as bytes, but doesnt change tree_items
303302
sio.seek(0)
304303

305304
istream=odb.store(IStream(str_tree_type,len(sio.getvalue()),sio))
306-
return (istream.binsha,tree_items_stringified)
305+
return (istream.binsha,tree_items)
307306

308307

309308
def_tree_entry_to_baseindexentry(tree_entry:Tuple[bytes,int,str],stage:int)->BaseIndexEntry:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp