Be aware that for Drupal, when testing patches from the core issues queue, you can only use the git apply
command on the main repository:
https://git.drupal.org/project/drupal.git (browse code)
(i.e. choose 8.2.x or 8.3.x according to issue )
and not on drupal-composer/drupal-project (e.g. a DrupalVM install)
This is logical, the commit IDs in the .patch file simply can’t be found in that repo, so git skips them. Instead you should use:
patch -p1 < example.patch
…as described here. (You still use -R
to reverse it.)
What’s less helpful is git apply
will give you no warning there’s a problem – you’ll run the command, see [ok]
but no other output, as though it had worked.
Likewise using any of these switches won’t print anything to the screen:
--verbose
--summary
--check
Annoying, the instructions for --check
imply it might tell you:
Instead of applying the patch, see if the patch is applicable to the current working tree and/or the index file and detects errors. Turns off “apply”.
(See also)
Suggested Checklist
- create a new branch for the patch you’re testing
- run
git diff
to check the files have actually been altered
- run
drush cr
too to reset cache/UI etc. before testing