Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add test for submodule path not owned by submodule case
  • Loading branch information
CosmosAtlas committed Sep 7, 2023
commit 9da24d46c64eaf4c7db65c0f67324801fafbf30d
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