aboutsummaryrefslogtreecommitdiff
path: root/git/objects/submodule
diff options
context:
space:
mode:
Diffstat (limited to 'git/objects/submodule')
-rw-r--r--git/objects/submodule/base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index a6b4caed..33151217 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -278,7 +278,7 @@ class Submodule(IndexObject, Iterable, Traversable):
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
@@ -358,7 +358,9 @@ class Submodule(IndexObject, Iterable, Traversable):
if sm.exists():
# reretrieve submodule from tree
try:
- return repo.head.commit.tree[path]
+ sm = repo.head.commit.tree[path]
+ sm._name = name
+ return sm
except KeyError:
# could only be in index
index = repo.index