-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If invalid value given to clone-recursive, raise exception #13839
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -600,6 +600,9 @@ def _get_git(self, packagename: str) -> None: | |
if self.wrap.values.get('depth', '') != '': | ||
is_shallow = True | ||
depth_option = ['--depth', self.wrap.values.get('depth')] | ||
clone_recursive_val = self.wrap.values.get('clone-recursive', '').lower() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Placing this earlier in the function is an improvement. Now if there's an invalid value in the wrap file, meson will error out sooner. When the value is corrected, meson will clone the repository and the submodules. Previously, after a failed attempt, meson would make no attempt to clone the submodules even after the value was corrected in the wrap file. There is still a parser error if no value is provided to clone-recursive, which is the desired behavior. An exception will be raised if a value is given other than 'true' or 'false'. If 'clone-recursive' is not included in the wrap file at all, 'false' will be assumed. |
||
if clone_recursive_val and clone_recursive_val not in ['false', 'true']: | ||
raise WrapException(f"clone-recursive: invalid value '{clone_recursive_val}' (use 'true' or 'false')") | ||
# for some reason git only allows commit ids to be shallowly fetched by fetch not with clone | ||
if is_shallow and self.is_git_full_commit_id(revno): | ||
# git doesn't support directly cloning shallowly for commits, | ||
|
@@ -622,7 +625,7 @@ 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': | ||
if clone_recursive_val == 'true': | ||
verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option], | ||
self.dirname, check=True) | ||
push_url = self.wrap.values.get('push-url') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, I added a space on both sides of the = sign (to match the examples on the wrap manual page).