summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/index/fun.py5
-rw-r--r--git/objects/fun.py14
2 files changed, 10 insertions, 9 deletions
diff --git a/git/index/fun.py b/git/index/fun.py
index 774738db..5c09f2b9 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -388,8 +388,9 @@ def aggressive_tree_merge(odb, tree_shas: Sequence[bytes]) -> List[BaseIndexEntr
# all three can't be None
if ours is None:
# added in their branch
- out.append(_tree_entry_to_baseindexentry(theirs, 0)) # type: ignore
- elif theirs is None: # ours is not None, theirs is None
+ assert theirs is not None
+ out.append(_tree_entry_to_baseindexentry(theirs, 0))
+ elif theirs is None:
# added in our branch
out.append(_tree_entry_to_baseindexentry(ours, 0))
else:
diff --git a/git/objects/fun.py b/git/objects/fun.py
index 57cefcf2..be541eb8 100644
--- a/git/objects/fun.py
+++ b/git/objects/fun.py
@@ -9,7 +9,7 @@ from git.compat import (
# typing ----------------------------------------------
-from typing import Callable, List, Sequence, Tuple, TYPE_CHECKING, Union, overload
+from typing import Callable, List, MutableSequence, Sequence, Tuple, TYPE_CHECKING, Union, overload
if TYPE_CHECKING:
from _typeshed import ReadableBuffer
@@ -102,24 +102,24 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]:
return out
-def _find_by_name(tree_data: List[EntryTupOrNone], name: str, is_dir: bool, start_at: int
+def _find_by_name(tree_data: MutableSequence[EntryTupOrNone], name: str, is_dir: bool, start_at: int
) -> EntryTupOrNone:
"""return data entry matching the given name and tree mode
or None.
Before the item is returned, the respective data item is set
None in the tree_data list to mark it done"""
- tree_data_list: List[EntryTupOrNone] = tree_data
+
try:
- item = tree_data_list[start_at]
+ item = tree_data[start_at]
if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
- tree_data_list[start_at] = None
+ tree_data[start_at] = None
return item
except IndexError:
pass
# END exception handling
- for index, item in enumerate(tree_data_list):
+ for index, item in enumerate(tree_data):
if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
- tree_data_list[index] = None
+ tree_data[index] = None
return item
# END if item matches
# END for each item