Skip to content

Commit

Permalink
Merge pull request #1647 from CosmosAtlas/master
Browse files Browse the repository at this point in the history
Added test for PR #1645 submodule path
  • Loading branch information
Byron authored Sep 7, 2023
2 parents 11839ab + fafb4f6 commit 8017421
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
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

0 comments on commit 8017421

Please sign in to comment.