From c7b16ade191bb753ebadb45efe6be7386f67351d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 17 Jan 2015 15:53:55 +0100 Subject: Submodule.remove() now deals with .git files correctly. A simple test verifies this at least. --- git/repo/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'git/repo/base.py') 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 -- cgit v1.2.1