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

Avoid taking a lock for reading (#1388)#1391

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 2 commits intomainfromindex-no-read-lock
Jan 7, 2022
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
3 changes: 3 additions & 0 deletions.github/workflows/pythonpackage.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,6 +50,9 @@ jobs:
flake8

- name: Check types with mypy
# With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true
run: |
set -x
mypy -p git
Expand Down
17 changes: 2 additions & 15 deletionsgit/index/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -127,30 +127,17 @@ def __init__(self, repo: 'Repo', file_path: Union[PathLike, None] = None) -> Non

def _set_cache_(self, attr: str) -> None:
if attr == "entries":
# read the current index
# try memory map for speed
lfd = LockedFD(self._file_path)
ok = False
try:
fd = lfd.open(write=False, stream=False)
ok = True
fd = os.open(self._file_path, os.O_RDONLY)
except OSError:
# in new repositories, there may be no index, which means we are empty
self.entries: Dict[Tuple[PathLike, StageType], IndexEntry] = {}
return None
finally:
if not ok:
lfd.rollback()
# END exception handling

stream = file_contents_ro(fd, stream=True, allow_mmap=True)

try:
self._deserialize(stream)
finally:
lfd.rollback()
# The handles will be closed on destruction
# END read from default index on demand
self._deserialize(stream)
else:
super(IndexFile, self)._set_cache_(attr)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp