Skip to content

Commit

Permalink
Raise exception if invalid values are given to 'clone-recursive'
Browse files Browse the repository at this point in the history
Fixes #13821 but perhaps a separate ticket should be opened for a
related bug, or maybe some extra docs are needed. Note in the ticket I
mentioned three things I had to do to get it working as expected after
the failures.
  • Loading branch information
andy5995 committed Nov 19, 2024
1 parent 33376ef commit a78d01c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/markdown/Release-notes-for-0.48.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ files get exported.
To enable this, the following needs to be added to the `.wrap` file:

```ini
clone-recursive=true
clone-recursive = true
```

## `subproject()` function now supports the `required:` kwarg
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/Wrap-dependency-system-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ case, the directory will be copied into `subprojects/` before applying patches.
- `push-url` - alternative url to configure as a git push-url. Useful if
the subproject will be developed and changes pushed upstream.
*(since 0.37.0)*
- `clone-recursive` - also clone submodules of the repository
- `clone-recursive = true` - also clone submodules of the repository
*(since 0.48.0)*

## wrap-file with Meson build patch
Expand Down
5 changes: 4 additions & 1 deletion mesonbuild/wrap/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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,
Expand All @@ -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')
Expand Down

0 comments on commit a78d01c

Please sign in to comment.