From 29710ea1ac8639328a5b7c6f8879d59d60088e6d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 30 Oct 2024 11:48:07 -0500 Subject: [PATCH] Raise exception if invalid values are given to 'clone-recursive' --- mesonbuild/wrap/wrap.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 7aae1663fd1f..20703627b4dd 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -622,9 +622,15 @@ def _get_git(self, packagename: str) -> None: args += ['--branch', revno] args += [self.wrap.get('url'), self.directory] verbose_git(args, self.subdir_root, check=True) - if self.wrap.values.get('clone-recursive', '').lower() == 'true': - verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option], - self.dirname, check=True) + + clone_recursive_val = self.wrap.values.get('clone-recursive') + if clone_recursive_val is not None: + clone_recursive_val = self.wrap.values.get('clone-recursive', '').lower() + if clone_recursive_val == 'true': + verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option], + self.dirname, check=True) + elif clone_recursive_val != 'false': + raise WrapException('clone-recursive: invalid value (use \'true\' or \'false\')') push_url = self.wrap.values.get('push-url') if push_url: verbose_git(['remote', 'set-url', '--push', 'origin', push_url], self.dirname, check=True)