From 9da24d46c64eaf4c7db65c0f67324801fafbf30d Mon Sep 17 00:00:00 2001 From: "Wenhan Zhu (Cosmos)" Date: Wed, 6 Sep 2023 20:50:57 -0400 Subject: [PATCH 1/2] add test for submodule path not owned by submodule case --- test/test_submodule.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_submodule.py b/test/test_submodule.py index d906a5d5b..8c98a671e 100644 --- a/test/test_submodule.py +++ b/test/test_submodule.py @@ -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")) From fafb4f6651eac242a7e143831fbe23d10beaf89b Mon Sep 17 00:00:00 2001 From: "Wenhan Zhu (Cosmos)" Date: Wed, 6 Sep 2023 20:54:07 -0400 Subject: [PATCH 2/2] updated docs to better describe testing procedure with new repo --- AUTHORS | 1 + README.md | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8ccc09fc0..ba5636db8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -51,4 +51,5 @@ Contributors are: -Luke Twist -Joseph Hale -Santos Gallegos +-Wenhan Zhu Portions derived from other open source works and are clearly marked. diff --git a/README.md b/README.md index 1743bd3d2..94fcc76d9 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,9 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525). ### RUNNING TESTS -_Important_: Right after cloning this repository, please be sure to have executed -the `./init-tests-after-clone.sh` script in the repository root. Otherwise -you will encounter test failures. +_Important_: Right after cloning this repository, please be sure to have +executed `git fetch --tags` followed by the `./init-tests-after-clone.sh` +script in the repository root. Otherwise you will encounter test failures. On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe` exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine