◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
num_branches_with_new_commits += len(mod.git.cherry(rref)) != 0
# END for each remote ref
# not a single remote branch contained all our commits
if num_branches_with_new_commits == len(rrefs):
raise InvalidGitRepositoryError(
"Cannot delete module at %s as there are new commits" % mod.working_tree_dir)
# END handle new commits
Expand Down
6 changes: 4 additions & 2 deletions git/test/lib/helper.py
Original file line number Diff line number Diff line change
@@ -94,8 +94,8 @@ def wrapper(self):
try:
return func(self, path)
except Exception:
log.info.write("Test %s.%s failed, output is at %r\n",
type(self).__name__, func.__name__, path)
keep = True
raise
finally:
Expand All @@ -107,6 +107,8 @@ def wrapper(self):
gc.collect()
if not keep:
rmtree(path)


def with_rw_repo(working_tree_ref, bare=False):
Expand Down
22 changes: 20 additions & 2 deletions git/test/test_submodule.py
Original file line number Diff line number Diff line change
@@ -317,8 +317,8 @@ def _do_base_tests(self, rwrepo):
# forcibly delete the child repository
prev_count = len(sm.children())
self.failUnlessRaises(ValueError, csm.remove, force=True)
# We removed sm, which removed all submodules. Howver, the instance we have
# still points to the commit prior to that, where it still existed
csm.set_parent_commit(csm.repo.commit(), check=False)
assert not csm.exists()
assert not csm.module_exists()
Expand Down Expand Up @@ -801,6 +801,24 @@ def assert_exists(sm, value=True):
assert os.path.isdir(sm_module_path) == dry_run
# end for each dry-run mode

@with_rw_directory
def test_rename(self, rwdir):
parent = git.Repo.init(os.path.join(rwdir, 'parent'))
Expand Down
Toggle all file notes Toggle all file annotations