Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ Contributors are:
-Alexis Horgix Chotard
-Piotr Babij <piotr.babij _at_ gmail.com>
-Mikuláš Poul <mikulaspoul _at_ gmail.com>
-Charles Bouchard-Légaré <cblegare.atl _at_ ntis.ca>

Portions derived from other open source works and are clearly marked.
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _to_relative_path(cls, parent_repo, path):
if not path.startswith(working_tree_linux):
raise ValueError("Submodule checkout path '%s' needs to be within the parents repository at '%s'"
% (working_tree_linux, path))
path = path[len(working_tree_linux) + 1:]
path = path[len(working_tree_linux.rstrip('/')) + 1:]
if not path:
raise ValueError("Absolute submodule path '%s' didn't yield a valid relative path" % path)
# end verify converted relative path makes sense
Expand Down
12 changes: 11 additions & 1 deletion git/test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import git
from git.cmd import Git
from git.compat import string_types
from git.compat import string_types, is_win
from git.exc import (
InvalidGitRepositoryError,
RepositoryDirtyError
Expand Down Expand Up @@ -911,3 +911,13 @@ def test_branch_renames(self, rw_dir):
parent_repo.submodule_update(to_latest_revision=True, force_reset=True)
assert sm_mod.commit() == sm_pfb.commit, "Now head should have been reset"
assert sm_mod.head.ref.name == sm_pfb.name

@skipIf(not is_win, "Specifically for Windows.")
def test_to_relative_path_with_super_at_root_drive(self):
class Repo(object):
working_tree_dir = 'D:\\'
super_repo = Repo()
submodule_path = 'D:\\submodule_path'
relative_path = Submodule._to_relative_path(super_repo, submodule_path)
msg = '_to_relative_path should be "submodule_path" but was "%s"' % relative_path
assert relative_path == 'submodule_path', msg
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy