Rerolling patches for PSR-4
All Drupal 8 core module code was recently converted to the PSR-4 standard. This issue moved hundreds of files and so many patches will need rerolls. You can update patches safely with the following workflow (provided by @donquixote):
- Ensure you have the latest 8.x HEAD in your Drupal 8 repository:
git pull origin 8.x
git checkout -b tmp 00339b3d
to create a new a new (temporary) branch from the Drupal 8 commit hash before the patch for Issue #2247991 was committed.git apply --index
the patch and commit to the new branch.git rebase 8.x
-- This should actually preserve all the local changes to existing files, because git understands if a file has been moved.- Run
php core/scripts/switch-psr4.sh
and commit the changes. This is for files that were added in the patch or local branch. Remember, this script will add and remove files without updating the git index, so you will need to add and remove files withgit add
. git diff 8.x
to produce a new version of the patch.- Upload the new patch to the issue and set the issue "Needs review".
As always, be sure to review your updated patch carefully for any errors.
Original Article: