| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,30 +127,17 @@ def __init__(self, repo: 'Repo', file_path: Union[PathLike, None] = None) -> Non | |||
| 127 | 127 | ||
| 128 | 128 | def _set_cache_(self, attr: str) -> None: | |
| 129 | 129 | if attr == "entries": | |
| 130 | - # read the current index | ||
| 131 | - # try memory map for speed | ||
| 132 | - lfd = LockedFD(self._file_path) | ||
| 133 | - ok = False | ||
| 134 | 130 | try: | |
| 135 | - fd = lfd.open(write=False, stream=False) | ||
| 136 | - ok = True | ||
| 131 | + fd = os.open(self._file_path, os.O_RDONLY) | ||
| 137 | 132 | except OSError: | |
| 138 | 133 | # in new repositories, there may be no index, which means we are empty | |
| 139 | 134 | self.entries: Dict[Tuple[PathLike, StageType], IndexEntry] = {} | |
| 140 | 135 | return None | |
| 141 | - finally: | ||
| 142 | - if not ok: | ||
| 143 | - lfd.rollback() | ||
| 144 | 136 | # END exception handling | |
| 145 | 137 | ||
| 146 | 138 | stream = file_contents_ro(fd, stream=True, allow_mmap=True) | |
| 147 | 139 | ||
| 148 | - try: | ||
| 149 | - self._deserialize(stream) | ||
| 150 | - finally: | ||
| 151 | - lfd.rollback() | ||
| 152 | - # The handles will be closed on destruction | ||
| 153 | - # END read from default index on demand | ||
| 140 | + self._deserialize(stream) | ||
| 154 | 141 | else: | |
| 155 | 142 | super(IndexFile, self)._set_cache_(attr) | |
| 156 | 143 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments