Skip to content

Commit

Permalink
add test for submodule path not owned by submodule case
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmosAtlas committed Sep 7, 2023
1 parent 11839ab commit 9da24d4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,28 @@ def assert_exists(sm, value=True):
assert osp.isdir(sm_module_path) == dry_run
# end for each dry-run mode

@with_rw_directory
def test_ignore_non_submodule_file(self, rwdir):
parent = git.Repo.init(rwdir)

smp = osp.join(rwdir, "module")
os.mkdir(smp)

with open(osp.join(smp, "a"), "w", encoding="utf-8") as f:
f.write('test\n')

with open(osp.join(rwdir, ".gitmodules"), "w", encoding="utf-8") as f:
f.write("[submodule \"a\"]\n")
f.write(" path = module\n")
f.write(" url = https://github.com/chaconinc/DbConnector\n")

parent.git.add(Git.polish_url(osp.join(smp, "a")))
parent.git.add(Git.polish_url(osp.join(rwdir, ".gitmodules")))

parent.git.commit(message='test')

assert len(parent.submodules) == 0

@with_rw_directory
def test_remove_norefs(self, rwdir):
parent = git.Repo.init(osp.join(rwdir, "parent"))
Expand Down

0 comments on commit 9da24d4

Please sign in to comment.