diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-10-30 21:55:22 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2024-02-09 21:04:31 +0530 |
commit | 348c2e93d23b3f087e72cb04c3f6e2f2572c4fa9 (patch) | |
tree | eb295096f12d29360dc6145f96ee31e10926a31a | |
parent | e0d83359aa125204429e3070eda1ae79767abafa (diff) | |
download | meson-348c2e93d23b3f087e72cb04c3f6e2f2572c4fa9.zip meson-348c2e93d23b3f087e72cb04c3f6e2f2572c4fa9.tar.gz meson-348c2e93d23b3f087e72cb04c3f6e2f2572c4fa9.tar.bz2 |
Revert "Wrap: Use git instead of patch by default"
This reverts commit 718c86a7d577e6474ff325957248724d9b786174.
We can't always use git to apply patches because they might actually
apply to a git submodule inside a git subproject, and git will not be
able to apply the patch in that case.
-rw-r--r-- | mesonbuild/wrap/wrap.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 9a310bc..d302e9d 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -809,17 +809,15 @@ class Resolver: if not path.exists(): raise WrapException(f'Diff file "{path}" does not exist') relpath = os.path.relpath(str(path), self.dirname) - if GIT: - # Git is more likely to be available on Windows and more likely - # to apply correctly assuming patches are often generated by git. - # See https://github.com/mesonbuild/meson/issues/12092. - # The `--work-tree` is necessary in case we're inside a + if PATCH: + # Always pass a POSIX path to patch, because on Windows it's MSYS + cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())] + elif GIT: + # If the `patch` command is not available, fall back to `git + # apply`. The `--work-tree` is necessary in case we're inside a # Git repository: by default, Git will try to apply the patch to # the repository root. cmd = [GIT, '--work-tree', '.', 'apply', '-p1', relpath] - elif PATCH: - # Always pass a POSIX path to patch, because on Windows it's MSYS - cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())] else: raise WrapException('Missing "patch" or "git" commands to apply diff files') |