summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 6d9af6d4..74e72aa5 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -131,14 +131,18 @@ class Repo(object):
# walk up the path to find the .git dir
while curpath:
+ # ABOUT os.path.NORMPATH
+ # It's important to normalize the paths, as submodules will otherwise initialize their
+ # repo instances with paths that depend on path-portions that will not exist after being
+ # removed. It's just cleaner.
if is_git_dir(curpath):
- self.git_dir = curpath
+ self.git_dir = os.path.normpath(curpath)
self._working_tree_dir = os.path.dirname(self.git_dir)
break
gitpath = find_git_dir(join(curpath, '.git'))
if gitpath is not None:
- self.git_dir = gitpath
+ self.git_dir = os.path.normpath(gitpath)
self._working_tree_dir = curpath
break