Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork938
BF: remove a submodule with a remote without refs + misc fixes around#521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
f2b92c6
31fd955
2528d11
f284a4e
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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.However, the instance we | ||
#havestill 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() | ||
@@ -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_remove_norefs(self, rwdir): | ||
parent = git.Repo.init(os.path.join(rwdir, 'parent')) | ||
sm_name = 'mymodules/myname' | ||
sm = parent.create_submodule(sm_name, sm_name, url=self._small_repo_url()) | ||
assert sm.exists() | ||
parent.index.commit("Added submodule") | ||
assert sm.repo is parent # yoh was surprised since expected sm repo!! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. and I am not sure why that is the case -- I was expecting submodules repo to be the repo of the submodule ... but I guess it can make sense to refer to parent which contains the submodule, but then is there an attribute for submodules repo (if present)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. @Byron any comment? I'm not familiar with git-modules. | ||
# so created a new instance for submodule | ||
smrepo = git.Repo(os.path.join(rwdir, 'parent', sm.path)) | ||
# Adding a remote without fetching so would have no references | ||
smrepo.create_remote('special', 'git@server-shouldnotmatter:repo.git') | ||
# And we should be able to remove it just fine | ||
sm.remove() | ||
assert not sm.exists() | ||
@with_rw_directory | ||
def test_rename(self, rwdir): | ||
parent = git.Repo.init(os.path.join(rwdir, 'parent')) | ||