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

Commit32c02d1

Browse files
authored
Merge pull request#1789 from EliahKagan/return
Fix mypy warning "Missing return statement"
2 parentsb2c46f7 +e194d46 commit32c02d1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

‎git/index/base.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,23 +381,21 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
381381
arg_list.append("--aggressive")
382382
# END merge handling
383383

384-
# tmp file created in git home directory to be sure renaming
385-
# works - /tmp/ dirs could be on another device.
386-
withcontextlib.ExitStack()asstack:
387-
tmp_index=stack.enter_context(_named_temporary_file_for_subprocess(repo.git_dir))
384+
# Create the temporary file in the .git directory to be sure renaming
385+
# works - /tmp/ directories could be on another device.
386+
with_named_temporary_file_for_subprocess(repo.git_dir)astmp_index:
388387
arg_list.append("--index-output=%s"%tmp_index)
389388
arg_list.extend(treeish)
390389

391-
# Move current index out of the way - otherwise the merge may fail
390+
# Movethecurrent index out of the way - otherwise the merge may fail
392391
# as it considers existing entries. Moving it essentially clears the index.
393392
# Unfortunately there is no 'soft' way to do it.
394393
# The TemporaryFileSwap ensures the original file gets put back.
395-
396-
stack.enter_context(TemporaryFileSwap(join_path_native(repo.git_dir,"index")))
397-
repo.git.read_tree(*arg_list,**kwargs)
398-
index=cls(repo,tmp_index)
399-
index.entries# Force it to read the file as we will delete the temp-file.
400-
returnindex
394+
withTemporaryFileSwap(join_path_native(repo.git_dir,"index")):
395+
repo.git.read_tree(*arg_list,**kwargs)
396+
index=cls(repo,tmp_index)
397+
index.entries# Force it to read the file as we will delete the temp-file.
398+
returnindex
401399
# END index merge handling
402400

403401
# UTILITIES

‎git/index/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
fromtypingimportAny,Callable,TYPE_CHECKING,Optional,Type
1717

18-
fromgit.typesimportPathLike,_T
18+
fromgit.typesimportLiteral,PathLike,_T
1919

2020
ifTYPE_CHECKING:
2121
fromgit.indeximportIndexFile
@@ -55,7 +55,7 @@ def __exit__(
5555
exc_type:Optional[Type[BaseException]],
5656
exc_val:Optional[BaseException],
5757
exc_tb:Optional[TracebackType],
58-
)->bool:
58+
)->Literal[False]:
5959
ifosp.isfile(self.tmp_file_path):
6060
os.replace(self.tmp_file_path,self.file_path)
6161
returnFalse

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp