| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 12e15ba commit 8434967
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -404,7 +404,7 @@ def _iter_expand_paths(self: "IndexFile", paths: Sequence[PathLike]) -> Iterator | |||
| 404 | 404 | def raise_exc(e: Exception) -> NoReturn: | |
| 405 | 405 | raise e | |
| 406 | 406 | ||
| 407 | - r = os.fspath(self.repo.working_tree_dir) | ||
| 407 | + r = str(self.repo.working_tree_dir) | ||
| 408 | 408 | rs = r + os.sep | |
| 409 | 409 | for path in paths: | |
| 410 | 410 | abs_path = os.fspath(path) | |
@@ -656,7 +656,7 @@ def _to_relative_path(self, path: PathLike) -> PathLike: | |||
| 656 | 656 | return path | |
| 657 | 657 | if self.repo.bare: | |
| 658 | 658 | raise InvalidGitRepositoryError("require non-bare repository") | |
| 659 | - if not osp.normpath(path).startswith(os.fspath(self.repo.working_tree_dir)): | ||
| 659 | + if not osp.normpath(path).startswith(str(self.repo.working_tree_dir)): | ||
| 660 | 660 | raise ValueError("Absolute path %r is not in git repository at %r" % (path, self.repo.working_tree_dir)) | |
| 661 | 661 | result = os.path.relpath(path, self.repo.working_tree_dir) | |
| 662 | 662 | if os.fspath(path).endswith(os.sep) and not result.endswith(os.sep): | |
@@ -731,7 +731,7 @@ def _entries_for_paths( | |||
| 731 | 731 | for path in paths: | |
| 732 | 732 | if osp.isabs(path): | |
| 733 | 733 | abspath = path | |
| 734 | - gitrelative_path = path[len(os.fspath(self.repo.working_tree_dir)) + 1 :] | ||
| 734 | + gitrelative_path = path[len(str(self.repo.working_tree_dir)) + 1 :] | ||
| 735 | 735 | else: | |
| 736 | 736 | gitrelative_path = path | |
| 737 | 737 | if self.repo.working_tree_dir: | |
@@ -1036,7 +1036,7 @@ def remove( | |||
| 1036 | 1036 | args.append("--") | |
| 1037 | 1037 | ||
| 1038 | 1038 | # Preprocess paths. | |
| 1039 | - paths = self._items_to_rela_paths(items) | ||
| 1039 | + paths = list(map(os.fspath, self._items_to_rela_paths(items))) # type: ignore[arg-type] | ||
| 1040 | 1040 | removed_paths = self.repo.git.rm(args, paths, **kwargs).splitlines() | |
| 1041 | 1041 | ||
| 1042 | 1042 | # Process output to gain proper paths. | |
@@ -1363,7 +1363,7 @@ def make_exc() -> GitCommandError: | |||
| 1363 | 1363 | if not folder.endswith("/"): | |
| 1364 | 1364 | folder += "/" | |
| 1365 | 1365 | for entry in self.entries.values(): | |
| 1366 | - if entry.path.startswith(folder): | ||
| 1366 | + if os.fspath(entry.path).startswith(folder): | ||
| 1367 | 1367 | p = entry.path | |
| 1368 | 1368 | self._write_path_to_stdin(proc, p, p, make_exc, fprogress, read_from_stdout=False) | |
| 1369 | 1369 | checked_out_files.append(p) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | # typing ---------------------------------------------------------------------- | |
| 17 | 17 | ||
| 18 | - from typing import Any, Callable, TYPE_CHECKING, Optional, Type | ||
| 18 | + from typing import Any, Callable, TYPE_CHECKING, Optional, Type, cast | ||
| 19 | 19 | ||
| 20 | 20 | from git.types import Literal, PathLike, _T | |
| 21 | 21 | ||
@@ -106,7 +106,7 @@ def git_working_dir(func: Callable[..., _T]) -> Callable[..., _T]: | |||
| 106 | 106 | @wraps(func) | |
| 107 | 107 | def set_git_working_dir(self: "IndexFile", *args: Any, **kwargs: Any) -> _T: | |
| 108 | 108 | cur_wd = os.getcwd() | |
| 109 | - os.chdir(self.repo.working_tree_dir) | ||
| 109 | + os.chdir(cast(PathLike, self.repo.working_tree_dir)) | ||
| 110 | 110 | try: | |
| 111 | 111 | return func(self, *args, **kwargs) | |
| 112 | 112 | finally: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -352,7 +352,7 @@ def _clone_repo( | |||
| 352 | 352 | module_abspath_dir = osp.dirname(module_abspath) | |
| 353 | 353 | if not osp.isdir(module_abspath_dir): | |
| 354 | 354 | os.makedirs(module_abspath_dir) | |
| 355 | - module_checkout_path = osp.join(repo.working_tree_dir, path) | ||
| 355 | + module_checkout_path = osp.join(repo.working_tree_dir, path) # type: ignore[arg-type] | ||
| 356 | 356 | ||
| 357 | 357 | if url.startswith("../"): | |
| 358 | 358 | remote_name = cast("RemoteReference", repo.active_branch.tracking_branch()).remote_name | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -236,7 +236,7 @@ def _get_ref_info_helper( | |||
| 236 | 236 | tokens: Union[None, List[str], Tuple[str, str]] = None | |
| 237 | 237 | repodir = _git_dir(repo, ref_path) | |
| 238 | 238 | try: | |
| 239 | - with open(os.path.join(repodir, ref_path), "rt", encoding="UTF-8") as fp: | ||
| 239 | + with open(os.path.join(repodir, ref_path), "rt", encoding="UTF-8") as fp: # type: ignore[arg-type] | ||
| 240 | 240 | value = fp.read().rstrip() | |
| 241 | 241 | # Don't only split on spaces, but on whitespace, which allows to parse lines like: | |
| 242 | 242 | # 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo | |
| Back | FazBrowse Home | New Git URL |
0 commit comments