Skip to content

Commit ebe8f64

Browse files
committedNov 18, 2010
Added test for the recursive code path.
1 parent 3f2d76b commit ebe8f64

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎lib/git/objects/submodule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init=
11211121
# or defective depth. The RootSubmodule type will never process itself,
11221122
# which was done in the previous expression
11231123
if recursive:
1124-
type(cls)(sm.module()).update(recursive=True, force_remove=force_remove,
1124+
type(self)(sm.module()).update(recursive=True, force_remove=force_remove,
11251125
init=init, to_latest_revision=to_latest_revision)
11261126
#END handle recursive
11271127
# END for each submodule to update

‎test/git/test_submodule.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ def test_root_module(self, rwrepo):
394394
#================
395395
nsmn = "newsubmodule"
396396
nsmp = "submrepo"
397-
nsm = Submodule.add(rwrepo, nsmn, nsmp, url=join_path_native(self.rorepo.working_tree_dir, rsms[0].path, rsms[1].path))
397+
async_url = join_path_native(self.rorepo.working_tree_dir, rsms[0].path, rsms[1].path)
398+
nsm = Submodule.add(rwrepo, nsmn, nsmp, url=async_url)
398399
csmadded = rwrepo.index.commit("Added submodule")
399400
nsm.set_parent_commit(csmadded)
400401
assert nsm.module_exists()
@@ -466,8 +467,16 @@ def test_root_module(self, rwrepo):
466467
assert nsmmh.ref.tracking_branch() is not None
467468
assert not nsmmh.is_detached
468469

469-
470470
# recursive update
471471
# =================
472472
# finally we recursively update a module, just to run the code at least once
473+
# remove the module so that it has more work
474+
assert len(nsm.children()) == 1
475+
assert nsm.exists() and nsm.module_exists() and len(nsm.children()) == 1
476+
# assure we pull locally only
477+
nsmc = nsm.children()[0]
478+
nsmc.config_writer().set_value('url', async_url)
479+
rm.update(recursive=True)
480+
481+
assert len(nsm.children()) == 1 and nsmc.module_exists()
473482

0 commit comments

Comments
 (0)
Please sign in to comment.