Skip to content

Commit 9da24d4

Browse files
committed
add test for submodule path not owned by submodule case
1 parent 11839ab commit 9da24d4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_submodule.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,28 @@ def assert_exists(sm, value=True):
906906
assert osp.isdir(sm_module_path) == dry_run
907907
# end for each dry-run mode
908908

909+
@with_rw_directory
910+
def test_ignore_non_submodule_file(self, rwdir):
911+
parent = git.Repo.init(rwdir)
912+
913+
smp = osp.join(rwdir, "module")
914+
os.mkdir(smp)
915+
916+
with open(osp.join(smp, "a"), "w", encoding="utf-8") as f:
917+
f.write('test\n')
918+
919+
with open(osp.join(rwdir, ".gitmodules"), "w", encoding="utf-8") as f:
920+
f.write("[submodule \"a\"]\n")
921+
f.write(" path = module\n")
922+
f.write(" url = https://github.com/chaconinc/DbConnector\n")
923+
924+
parent.git.add(Git.polish_url(osp.join(smp, "a")))
925+
parent.git.add(Git.polish_url(osp.join(rwdir, ".gitmodules")))
926+
927+
parent.git.commit(message='test')
928+
929+
assert len(parent.submodules) == 0
930+
909931
@with_rw_directory
910932
def test_remove_norefs(self, rwdir):
911933
parent = git.Repo.init(osp.join(rwdir, "parent"))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy