From 9891e362bc80779e9eaa66021736191455008c80 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Wed, 26 Jan 2022 16:30:28 +0900 Subject: [PATCH] tests: add test for clone(shallow_branch=...) --- tests/test_scmrepo.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_scmrepo.py b/tests/test_scmrepo.py index 86c85346..b6f9140d 100644 --- a/tests/test_scmrepo.py +++ b/tests/test_scmrepo.py @@ -18,3 +18,13 @@ def test_clone(tmp_dir: TmpDir, matcher: Type[Matcher]): progress.assert_called_with(matcher.instance_of(GitProgressEvent)) assert (tmp_dir / "dir").exists() + + +def test_clone_shallow(tmp_dir: TmpDir): + url = "https://github.com/iterative/dvcyaml-schema" + shallow_branch = "master" + + repo = Git.clone(url, "dir", shallow_branch=shallow_branch) + shallow_file = tmp_dir / "dir" / ".git" / "shallow" + assert shallow_file.exists() + assert repo.get_rev() in shallow_file.read_text().splitlines()