From 09a96fb2ea908e20d5acb7445d542fa2f8d10bb6 Mon Sep 17 00:00:00 2001 From: Liam Beguin Date: Sat, 2 May 2020 15:31:03 -0400 Subject: [PATCH] add test case for submodule depth parameter Signed-off-by: Liam Beguin --- git/test/test_submodule.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 9dd439347..08d30ee79 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -936,3 +936,11 @@ class Repo(object): relative_path = Submodule._to_relative_path(super_repo, submodule_path) msg = '_to_relative_path should be "submodule_path" but was "%s"' % relative_path assert relative_path == 'submodule_path', msg + + @with_rw_directory + def test_depth(self, rwdir): + parent = git.Repo.init(osp.join(rwdir, 'test_depth')) + sm_name = 'mymodules/myname' + sm_depth = 1 + sm = parent.create_submodule(sm_name, sm_name, url=self._small_repo_url(), depth=sm_depth) + assert len(list(sm.module().iter_commits())) == sm_depth