Skip to content

Commit a9a5414

Browse files
committed
Fixed previously failing test
It actually revealed a bug in the implementation of Submodule.add, which just showed in python 3 for the wrong reasons. Thankfully, failing tests after all allowed to get this issue fixed ... .
1 parent 26fc586 commit a9a5414

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

git/objects/submodule/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
256256
# END assure url correctness
257257

258258
# INSTANTIATE INTERMEDIATE SM
259-
sm = cls(repo, cls.NULL_BIN_SHA, cls.k_default_mode, path, name)
259+
sm = cls(repo, cls.NULL_BIN_SHA, cls.k_default_mode, path, name, url='invalid-temporary')
260260
if sm.exists():
261261
# reretrieve submodule from tree
262262
try:
@@ -298,7 +298,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
298298
if not branch_is_default:
299299
kwargs['b'] = br.name
300300
# END setup checkout-branch
301-
mrepo = git.Repo.clone_from(url, path, **kwargs)
301+
mrepo = git.Repo.clone_from(url, os.path.join(repo.working_tree_dir, path), **kwargs)
302302
# END verify url
303303

304304
# update configuration and index

git/test/test_submodule.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ def test_add_empty_repo(self, rwdir):
610610
git.Repo.init(empty_repo_dir)
611611

612612
for checkout_mode in range(2):
613-
self.failUnlessRaises(ValueError, parent.create_submodule, 'empty', 'empty',
614-
url=empty_repo_dir, no_checkout=checkout_mode)
613+
name = 'empty' + str(checkout_mode)
614+
self.failUnlessRaises(ValueError, parent.create_submodule, name, name,
615+
url=empty_repo_dir, no_checkout=checkout_mode and True or False)
615616
# end for each checkout mode

0 commit comments

Comments
 (0)