Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test for PR #1645 submodule path #1647

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ Contributors are:
-Luke Twist <[email protected]>
-Joseph Hale <me _at_ jhale.dev>
-Santos Gallegos <stsewd _at_ proton.me>
-Wenhan Zhu <wzhu.cosmos _at_ gmail.com>
Portions derived from other open source works and are clearly marked.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Loading