summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/index/base.py2
-rw-r--r--git/index/fun.py7
2 files changed, 4 insertions, 5 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 6f6ea5aa..3aa06e38 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -572,7 +572,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
# note: additional deserialization could be saved if write_tree_from_cache
# would return sorted tree entries
root_tree = Tree(self.repo, binsha, path='')
- root_tree._cache = tree_items # type: ignore
+ root_tree._cache = tree_items # type: ignore # should this be encoded to [bytes, int, str]?
return root_tree
def _process_diff_args(self, # type: ignore[override]
diff --git a/git/index/fun.py b/git/index/fun.py
index 45785687..96833a7a 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -249,7 +249,7 @@ def read_cache(stream: IO[bytes]) -> Tuple[int, Dict[Tuple[PathLike, int], 'Inde
def write_tree_from_cache(entries: List[IndexEntry], odb, sl: slice, si: int = 0
- ) -> Tuple[bytes, List[Tuple[str, int, str]]]:
+ ) -> Tuple[bytes, List[Tuple[bytes, int, str]]]:
"""Create a tree from the given sorted list of entries and put the respective
trees into the given object database
@@ -298,12 +298,11 @@ def write_tree_from_cache(entries: List[IndexEntry], odb, sl: slice, si: int = 0
# finally create the tree
sio = BytesIO()
- tree_to_stream(tree_items, sio.write) # converts bytes of each item[0] to str
- tree_items_stringified = cast(List[Tuple[str, int, str]], tree_items)
+ tree_to_stream(tree_items, sio.write) # writes to stream as bytes, but doesnt change tree_items
sio.seek(0)
istream = odb.store(IStream(str_tree_type, len(sio.getvalue()), sio))
- return (istream.binsha, tree_items_stringified)
+ return (istream.binsha, tree_items)
def _tree_entry_to_baseindexentry(tree_entry: Tuple[bytes, int, str], stage: int) -> BaseIndexEntry: