summaryrefslogtreecommitdiffstats
path: root/tests/store_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:22 +0000
commitd7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8 (patch)
treef7d340787b36afcb3b78f2a0875c2c9c8419cdec /tests/store_test.py
parentReleasing debian version 3.0.4-1. (diff)
downloadpre-commit-d7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8.tar.xz
pre-commit-d7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8.zip
Merging upstream version 3.1.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/store_test.py')
-rw-r--r--tests/store_test.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/store_test.py b/tests/store_test.py
index c42ce65..eaab940 100644
--- a/tests/store_test.py
+++ b/tests/store_test.py
@@ -180,7 +180,7 @@ def test_create_when_store_already_exists(store):
def test_db_repo_name(store):
assert store.db_repo_name('repo', ()) == 'repo'
- assert store.db_repo_name('repo', ('b', 'a', 'c')) == 'repo:a,b,c'
+ assert store.db_repo_name('repo', ('b', 'a', 'c')) == 'repo:b,a,c'
def test_local_resources_reflects_reality():
@@ -246,3 +246,27 @@ def test_mark_config_as_used_readonly(tmpdir):
# should be skipped due to readonly
store.mark_config_used(str(cfg))
assert store.select_all_configs() == []
+
+
+def test_clone_with_recursive_submodules(store, tmp_path):
+ sub = tmp_path.joinpath('sub')
+ sub.mkdir()
+ sub.joinpath('submodule').write_text('i am a submodule')
+ cmd_output('git', '-C', str(sub), 'init', '.')
+ cmd_output('git', '-C', str(sub), 'add', '.')
+ git.commit(str(sub))
+
+ repo = tmp_path.joinpath('repo')
+ repo.mkdir()
+ repo.joinpath('repository').write_text('i am a repo')
+ cmd_output('git', '-C', str(repo), 'init', '.')
+ cmd_output('git', '-C', str(repo), 'add', '.')
+ cmd_output('git', '-C', str(repo), 'submodule', 'add', str(sub), 'sub')
+ git.commit(str(repo))
+
+ rev = git.head_rev(str(repo))
+ ret = store.clone(str(repo), rev)
+
+ assert os.path.exists(ret)
+ assert os.path.exists(os.path.join(ret, str(repo), 'repository'))
+ assert os.path.exists(os.path.join(ret, str(sub), 'submodule'))