From 9d5d143f72e4d588e3a0abb2ab82fa5a2c35e8aa Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Wed, 19 Oct 2016 16:01:47 +0200 Subject: repo: minor code and doc correcions. + Expansion of paths also `osp.normalize()` them. + Make Repo-fields --> class-fields to avoid initializations on construct. + Explain and rename `git.repo.fun.find_git_dir()` is for submodules (`find_submodule_git_dir()`). --- git/repo/fun.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'git/repo/fun.py') diff --git a/git/repo/fun.py b/git/repo/fun.py index 320eb1c8..fe0896a9 100644 --- a/git/repo/fun.py +++ b/git/repo/fun.py @@ -20,7 +20,7 @@ from git.exc import WorkTreeRepositoryUnsupported from git.compat import xrange -__all__ = ('rev_parse', 'is_git_dir', 'touch', 'find_git_dir', 'name_to_object', 'short_to_long', 'deref_tag', +__all__ = ('rev_parse', 'is_git_dir', 'touch', 'find_submodule_git_dir', 'name_to_object', 'short_to_long', 'deref_tag', 'to_commit') @@ -49,7 +49,8 @@ def is_git_dir(d): return False -def find_git_dir(d): +def find_submodule_git_dir(d): + """Search for a submodule repo.""" if is_git_dir(d): return d @@ -64,7 +65,7 @@ def find_git_dir(d): path = content[8:] if not os.path.isabs(path): path = join(dirname(d), path) - return find_git_dir(path) + return find_submodule_git_dir(path) # end handle exception return None -- cgit v1.2.1