We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 28cbb95 + 280e573 commit a2cd130Copy full SHA for a2cd130
AUTHORS
@@ -24,5 +24,6 @@ Contributors are:
24
-Alexis Horgix Chotard
25
-Piotr Babij <piotr.babij _at_ gmail.com>
26
-Mikuláš Poul <mikulaspoul _at_ gmail.com>
27
+-Charles Bouchard-Légaré <cblegare.atl _at_ ntis.ca>
28
29
Portions derived from other open source works and are clearly marked.
git/objects/submodule/base.py
@@ -278,7 +278,7 @@ def _to_relative_path(cls, parent_repo, path):
278
if not path.startswith(working_tree_linux):
279
raise ValueError("Submodule checkout path '%s' needs to be within the parents repository at '%s'"
280
% (working_tree_linux, path))
281
- path = path[len(working_tree_linux) + 1:]
+ path = path[len(working_tree_linux.rstrip('/')) + 1:]
282
if not path:
283
raise ValueError("Absolute submodule path '%s' didn't yield a valid relative path" % path)
284
# end verify converted relative path makes sense
git/test/test_submodule.py
@@ -10,7 +10,7 @@
10
11
import git
12
from git.cmd import Git
13
-from git.compat import string_types
+from git.compat import string_types, is_win
14
from git.exc import (
15
InvalidGitRepositoryError,
16
RepositoryDirtyError
@@ -911,3 +911,13 @@ def test_branch_renames(self, rw_dir):
911
parent_repo.submodule_update(to_latest_revision=True, force_reset=True)
912
assert sm_mod.commit() == sm_pfb.commit, "Now head should have been reset"
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
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments