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

Fix mypy warning "Missing return statement"#1789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 1 commit intogitpython-developers:mainfromEliahKagan:return
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletionsgit/index/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -381,23 +381,21 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
arg_list.append("--aggressive")
# END merge handling

# tmp file created in git home directory to be sure renaming
# works - /tmp/ dirs could be on another device.
with contextlib.ExitStack() as stack:
tmp_index = stack.enter_context(_named_temporary_file_for_subprocess(repo.git_dir))
# Create the temporary file in the .git directory to be sure renaming
# works - /tmp/ directories could be on another device.
with _named_temporary_file_for_subprocess(repo.git_dir) as tmp_index:
arg_list.append("--index-output=%s" % tmp_index)
arg_list.extend(treeish)

# Move current index out of the way - otherwise the merge may fail
# Movethecurrent index out of the way - otherwise the merge may fail
# as it considers existing entries. Moving it essentially clears the index.
# Unfortunately there is no 'soft' way to do it.
# The TemporaryFileSwap ensures the original file gets put back.

stack.enter_context(TemporaryFileSwap(join_path_native(repo.git_dir, "index")))
repo.git.read_tree(*arg_list, **kwargs)
index = cls(repo, tmp_index)
index.entries # Force it to read the file as we will delete the temp-file.
return index
with TemporaryFileSwap(join_path_native(repo.git_dir, "index")):
repo.git.read_tree(*arg_list, **kwargs)
index = cls(repo, tmp_index)
index.entries # Force it to read the file as we will delete the temp-file.
return index
# END index merge handling

# UTILITIES
Expand Down
4 changes: 2 additions & 2 deletionsgit/index/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@

from typing import Any, Callable, TYPE_CHECKING, Optional, Type

from git.types import PathLike, _T
from git.types importLiteral,PathLike, _T

if TYPE_CHECKING:
from git.index import IndexFile
Expand DownExpand Up@@ -55,7 +55,7 @@ def __exit__(
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) ->bool:
) ->Literal[False]:
if osp.isfile(self.tmp_file_path):
os.replace(self.tmp_file_path, self.file_path)
return False
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp