aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorL. E. Segovia <amy@amyspark.me>2022-11-30 18:39:54 -0300
committerXavier Claessens <xclaesse@gmail.com>2022-12-07 13:29:04 -0500
commit35599c536271c2d05c82b0f649ad1ab2f2d351d1 (patch)
treef22acbc5ace35d791a602bf00cd31ee5997c8f26 /unittests
parentbcd50e71d51eac2fa8e1afbb30cb7d5260e0f42a (diff)
downloadmeson-35599c536271c2d05c82b0f649ad1ab2f2d351d1.zip
meson-35599c536271c2d05c82b0f649ad1ab2f2d351d1.tar.gz
meson-35599c536271c2d05c82b0f649ad1ab2f2d351d1.tar.bz2
wrap: Don't use --branch with shallow clones against HEAD
Fixes #10931
Diffstat (limited to 'unittests')
-rw-r--r--unittests/subprojectscommandtests.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/unittests/subprojectscommandtests.py b/unittests/subprojectscommandtests.py
index edd6ac1..bca124d 100644
--- a/unittests/subprojectscommandtests.py
+++ b/unittests/subprojectscommandtests.py
@@ -103,15 +103,20 @@ class SubprojectsCommandTests(BasePlatformTests):
self._git_remote(['commit', '--no-gpg-sign', '--allow-empty', '-m', f'tag {tag} commit'], name)
self._git_remote(['tag', '--no-sign', tag], name)
- def _wrap_create_git(self, name, revision='master'):
+ def _wrap_create_git(self, name, revision='master', depth=None):
path = self.root_dir / name
with open(str((self.subprojects_dir / name).with_suffix('.wrap')), 'w', encoding='utf-8') as f:
+ if depth is None:
+ depth_line = ''
+ else:
+ depth_line = 'depth = {}'.format(depth)
f.write(textwrap.dedent(
'''
[wrap-git]
url={}
revision={}
- '''.format(os.path.abspath(str(path)), revision)))
+ {}
+ '''.format(os.path.abspath(str(path)), revision, depth_line)))
def _wrap_create_file(self, name, tarball='dummy.tar.gz'):
path = self.root_dir / tarball
@@ -205,6 +210,15 @@ class SubprojectsCommandTests(BasePlatformTests):
self._subprojects_cmd(['update', '--reset'])
self.assertEqual(self._git_local_commit(subp_name), self._git_remote_commit(subp_name))
+ # Create a fake remote git repository and a wrap file targeting
+ # HEAD and depth = 1. Checks that "meson subprojects download" works.
+ subp_name = 'sub3'
+ self._git_create_remote_repo(subp_name)
+ self._wrap_create_git(subp_name, revision='head', depth='1')
+ self._subprojects_cmd(['download'])
+ self.assertPathExists(str(self.subprojects_dir / subp_name))
+ self._git_config(self.subprojects_dir / subp_name)
+
@skipIfNoExecutable('true')
def test_foreach(self):
self._create_project(self.subprojects_dir / 'sub_file')