summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-17 15:53:55 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-17 15:53:55 +0100
commitc7b16ade191bb753ebadb45efe6be7386f67351d (patch)
tree8a7f64b7bc8cc989573d921d12f8cf7aad256b7c /git/repo/base.py
parent67680a0877f01177dc827beb49c83a9174cdb736 (diff)
downloadgitpython-c7b16ade191bb753ebadb45efe6be7386f67351d.tar.gz
Submodule.remove() now deals with .git files correctly.
A simple test verifies this at least.
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