This script splits a patch file into multiple patch files based on the modules that the patch is changing. It detects the module that is being changed and creates a different patch file for each module. The script also helps the user to configure PHP Composer to use the new patch that works with Composer.
- Run the script from the root of your Magento project.
- Provide the patch file as an argument, e.g.
./script.sh your_patch_file.patch
. - The script will create a new directory called
.composer_patches
(orcomposer_patches
orpatches
if one of these directories already exists) and split the patch file into multiple files, each corresponding to a different module. - The script will also output a JSON object that can be used to configure PHP Composer to use the new patch files.
- The script must be run from the root of a Magento project.
- The
composer.json
file must exist in the current directory.
- If the patch file only affects one module, the script will output a message indicating that the patch file only works with one module and exit.
- If the
composer.json
file contains the string "magento-cloud", the script will output a message indicating that the patch file should be placed in them2-hotfixes
directory and exit.