From abd968316667c17f46a7b0ed9add4ffb9c6d4054 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 30 May 2024 12:17:19 +0200 Subject: [PATCH] update --- git/objects/submodule/base.py | 4 ++-- git/objects/util.py | 6 +++--- git/refs/symbolic.py | 10 +++++----- test/lib/helper.py | 4 ++-- test/test_refs.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 5c671db76..df59a7536 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -416,11 +416,11 @@ def _write_git_file_and_module_config(cls, working_tree_dir: PathLike, module_ab Absolute path to the bare repository. """ git_file = osp.join(working_tree_dir, ".git") - relative_fpath = osp.relpath(module_abspath, start=working_tree_dir) + relative_path = osp.relpath(module_abspath, start=working_tree_dir) if sys.platform == "win32" and osp.isfile(git_file): os.remove(git_file) with open(git_file, "wb") as fp: - fp.write(("gitdir: %s" % relative_fpath).encode(defenc)) + fp.write(("gitdir: %s" % relative_path).encode(defenc)) with GitConfigParser(osp.join(module_abspath, "config"), read_only=False, merge_includes=False) as writer: writer.set_value( diff --git a/git/objects/util.py b/git/objects/util.py index 5d3dcd0d6..e8d1d4c93 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -568,11 +568,11 @@ def addToStack( yield rval # Only continue to next level if this is appropriate! - nb = d + 1 - if depth > -1 and nb > depth: + next_depth = d + 1 + if depth > -1 and next_depth > depth: continue - addToStack(stack, item, branch_first, nb) + addToStack(stack, item, branch_first, next_depth) # END for each item on work stack diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index a9f9578e7..08d79e428 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -272,7 +272,7 @@ def _get_ref_info(cls, repo: "Repo", ref_path: Union[PathLike, None]) -> Union[T :return: *(str(sha), str(target_ref_path))*, where: - * *sha* is of the file at relative_fpath points to if available, or ``None``. + * *sha* is of the file at relative_path points to if available, or ``None``. * *target_ref_path* is the reference we point to, or ``None``. """ return cls._get_ref_info_helper(repo, ref_path) @@ -813,7 +813,7 @@ def _iter_items( ) -> Iterator[T_References]: if common_path is None: common_path = cls._common_path_default - relative_fpaths = set() + relative_paths = set() # Walk loose refs. # Currently we do not follow links. @@ -828,19 +828,19 @@ def _iter_items( if f == "packed-refs": continue abs_path = to_native_path_linux(join_path(root, f)) - relative_fpaths.add(abs_path.replace(to_native_path_linux(repo.common_dir) + "/", "")) + relative_paths.add(abs_path.replace(to_native_path_linux(repo.common_dir) + "/", "")) # END for each file in root directory # END for each directory to walk # Read packed refs. for _sha, relative_fpath in cls._iter_packed_refs(repo): if relative_fpath.startswith(str(common_path)): - relative_fpaths.add(relative_fpath) + relative_paths.add(relative_fpath) # END relative path matches common path # END packed refs reading # Yield paths in sorted order. - for path in sorted(relative_fpaths): + for path in sorted(relative_paths): try: yield cls.from_path(repo, path) except ValueError: diff --git a/test/lib/helper.py b/test/lib/helper.py index fba32f96c..2a2d2bba0 100644 --- a/test/lib/helper.py +++ b/test/lib/helper.py @@ -386,7 +386,7 @@ def tearDownClass(cls): cls.rorepo.git.clear_cache() cls.rorepo.git = None - def _make_file(self, relative_fpath, data, repo=None): + def _make_file(self, relative_path, data, repo=None): """ Create a file at the given path relative to our repository, filled with the given data. @@ -394,7 +394,7 @@ def _make_file(self, relative_fpath, data, repo=None): :return: An absolute path to the created file. """ repo = repo or self.rorepo - abs_path = osp.join(repo.working_tree_dir, relative_fpath) + abs_path = osp.join(repo.working_tree_dir, relative_path) with open(abs_path, "w") as fp: fp.write(data) return abs_path diff --git a/test/test_refs.py b/test/test_refs.py index b41d40c42..7c46379eb 100644 --- a/test/test_refs.py +++ b/test/test_refs.py @@ -32,7 +32,7 @@ class TestRefs(TestBase): def test_from_path(self): # Should be able to create any reference directly. for ref_type in (Reference, Head, TagReference, RemoteReference): - for name in ("relative_fpath", "path/rela_name"): + for name in ("relative_name", "path/rela_name"): full_path = ref_type.to_full_path(name) instance = ref_type.from_path(self.rorepo, full_path) assert isinstance(instance, ref_type) @@ -454,7 +454,7 @@ def test_head_reset(self, rw_repo): # Rename it. orig_obj = ref.object - for name in ("refs/absname", "relative_fpath", "feature/rela_name"): + for name in ("refs/absname", "relative_name", "feature/rela_name"): ref_new_name = ref.rename(name) assert isinstance(ref_new_name, Reference) assert name in ref_new_name.path