| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,5 +24,6 @@ Contributors are: | |||
| 24 | 24 | -Alexis Horgix Chotard | |
| 25 | 25 | -Piotr Babij <piotr.babij _at_ gmail.com> | |
| 26 | 26 | -Mikuláš Poul <mikulaspoul _at_ gmail.com> | |
| 27 | + -Charles Bouchard-Légaré <cblegare.atl _at_ ntis.ca> | ||
| 27 | 28 | ||
| 28 | 29 | Portions derived from other open source works and are clearly marked. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -278,7 +278,7 @@ def _to_relative_path(cls, parent_repo, path): | |||
| 278 | 278 | if not path.startswith(working_tree_linux): | |
| 279 | 279 | raise ValueError("Submodule checkout path '%s' needs to be within the parents repository at '%s'" | |
| 280 | 280 | % (working_tree_linux, path)) | |
| 281 | - path = path[len(working_tree_linux) + 1:] | ||
| 281 | + path = path[len(working_tree_linux.rstrip('/')) + 1:] | ||
| 282 | 282 | if not path: | |
| 283 | 283 | raise ValueError("Absolute submodule path '%s' didn't yield a valid relative path" % path) | |
| 284 | 284 | # end verify converted relative path makes sense | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | 11 | import git | |
| 12 | 12 | from git.cmd import Git | |
| 13 | - from git.compat import string_types | ||
| 13 | + from git.compat import string_types, is_win | ||
| 14 | 14 | from git.exc import ( | |
| 15 | 15 | InvalidGitRepositoryError, | |
| 16 | 16 | RepositoryDirtyError | |
@@ -911,3 +911,13 @@ def test_branch_renames(self, rw_dir): | |||
| 911 | 911 | parent_repo.submodule_update(to_latest_revision=True, force_reset=True) | |
| 912 | 912 | assert sm_mod.commit() == sm_pfb.commit, "Now head should have been reset" | |
| 913 | 913 | assert sm_mod.head.ref.name == sm_pfb.name | |
| 914 | + | ||
| 915 | + @skipIf(not is_win, "Specifically for Windows.") | ||
| 916 | + def test_to_relative_path_with_super_at_root_drive(self): | ||
| 917 | + class Repo(object): | ||
| 918 | + working_tree_dir = 'D:\\' | ||
| 919 | + super_repo = Repo() | ||
| 920 | + submodule_path = 'D:\\submodule_path' | ||
| 921 | + relative_path = Submodule._to_relative_path(super_repo, submodule_path) | ||
| 922 | + msg = '_to_relative_path should be "submodule_path" but was "%s"' % relative_path | ||
| 923 | + assert relative_path == 'submodule_path', msg | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments