summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-20 18:33:43 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-20 20:17:32 +0100
commit8f24f9540afc0db61d197bc4932697737bff1506 (patch)
treecccf958a2c1a0907869342ca872ff17b44e7e9bb
parent8e0e315a371cdfc80993a1532f938d56ed7acee4 (diff)
downloadgitpython-8f24f9540afc0db61d197bc4932697737bff1506.tar.gz
Submodule: Assured we properly convert paths to using the slash separator
-rw-r--r--lib/git/objects/submodule/base.py6
-rw-r--r--test/git/test_submodule.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/git/objects/submodule/base.py b/lib/git/objects/submodule/base.py
index 403b2e18..7cc47e4b 100644
--- a/lib/git/objects/submodule/base.py
+++ b/lib/git/objects/submodule/base.py
@@ -211,6 +211,12 @@ class Submodule(util.IndexObject, Iterable, Traversable):
path = path[:-1]
# END handle trailing slash
+ # assure we never put backslashes into the url, as some operating systems
+ # like it ...
+ if url != None:
+ url = to_native_path_linux(url)
+ #END assure url correctness
+
# INSTANTIATE INTERMEDIATE SM
sm = cls(repo, cls.NULL_BIN_SHA, cls.k_default_mode, path, name)
if sm.exists():
diff --git a/test/git/test_submodule.py b/test/git/test_submodule.py
index 2ef45862..7b774285 100644
--- a/test/git/test_submodule.py
+++ b/test/git/test_submodule.py
@@ -378,7 +378,7 @@ class TestSubmodule(TestBase):
assert not sm.module_exists() # was never updated after rwrepo's clone
# assure we clone from a local source
- sm.config_writer().set_value('url', join_path_native(self.rorepo.working_tree_dir, sm.path))
+ sm.config_writer().set_value('url', to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, sm.path)))
sm.update(recursive=False)
assert sm.module_exists()
sm.config_writer().set_value('path', fp) # change path to something with prefix AFTER url change
@@ -406,7 +406,7 @@ class TestSubmodule(TestBase):
#================
nsmn = "newsubmodule"
nsmp = "submrepo"
- async_url = join_path_native(self.rorepo.working_tree_dir, rsms[0].path, rsms[1].path)
+ async_url = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsms[0].path, rsms[1].path))
nsm = Submodule.add(rwrepo, nsmn, nsmp, url=async_url)
csmadded = rwrepo.index.commit("Added submodule")
nsm.set_parent_commit(csmadded)
@@ -439,7 +439,7 @@ class TestSubmodule(TestBase):
# to the first repository, this way we have a fast checkout, and a completely different
# repository at the different url
nsm.set_parent_commit(csmremoved)
- nsmurl = join_path_native(self.rorepo.working_tree_dir, rsms[0].path)
+ nsmurl = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsms[0].path))
nsm.config_writer().set_value('url', nsmurl)
csmpathchange = rwrepo.index.commit("changed url")
nsm.set_parent_commit(csmpathchange)