From 192472f9673b18c91ce618e64e935f91769c50e7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 20 Jul 2010 16:18:01 +0200 Subject: BaseIndexEntry: Added to_blob method, refactored functionality sligthly repo.clone: assured backslashes won't reach the remote configuration, as it can cause trouble when re-reading the file later on. Some git commands don't appear to be able to properly deal with backslashes, other's do --- lib/git/repo/base.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/git/repo/base.py') diff --git a/lib/git/repo/base.py b/lib/git/repo/base.py index 4456b1e9..790b1283 100644 --- a/lib/git/repo/base.py +++ b/lib/git/repo/base.py @@ -651,7 +651,17 @@ class Repo(object): # environment, hence we prepend its working dir if required if not os.path.isabs(path) and git.working_dir: path = join(git._working_dir, path) - return cls(os.path.abspath(path), odbt = odbt) + + # adjust remotes - there may be operating systems which use backslashes, + # These might be given as initial paths, but when handling the config file + # that contains the remote from which we were clones, git stops liking it + # as it will escape the backslashes. Hence we undo the escaping just to be + # sure + repo = cls(os.path.abspath(path), odbt = odbt) + if repo.remotes: + repo.remotes[0].config_writer.set_value('url', repo.remotes[0].url.replace("\\\\", "\\").replace("\\", "/")) + # END handle remote repo + return repo def clone(self, path, **kwargs): """Create a clone from this repository. -- cgit v1.2.1