From 35de35ffeb4a5c5111d01a007ccf43524755cdec Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 9 Dec 2025 20:59:50 +0100 Subject: [PATCH 1/2] feat(applying-patch): improve documentation to also mention git apply as alternative Signed-off-by: Simon L. --- admin_manual/issues/applying_patch.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/admin_manual/issues/applying_patch.rst b/admin_manual/issues/applying_patch.rst index 93cae94b1..691717f6c 100644 --- a/admin_manual/issues/applying_patch.rst +++ b/admin_manual/issues/applying_patch.rst @@ -13,9 +13,10 @@ Patching server patch -p 1 < /path/to/the/file.patch -.. note:: +3. Alternatively, if the patch command is not available, use:: - There can be errors about not found files, especially when you take a patch from GitHub there might be development or test files included in the patch. when the files are in build/ or a tests/ subdirectory it is mostly being + git apply --check /path/to/the/file.diff + git apply /path/to/the/file.diff Patching apps ^^^^^^^^^^^^^ @@ -31,8 +32,12 @@ Reverting a patch patch -R -p 1 < /path/to/the/file.patch -Getting a patch from a GitHub pull request ------------------------------------------- +3. Alternatively, if the patch command is not available, use:: + + git apply --reverse /path/to/the/file.diff + +Notes and troubleshooting +------------------------- If you found a related pull request on GitHub that solves your issue, or you want to help developers and verify a fix works, you can get a patch for the pull request. From ee229f59b7b4be094344ab52b6a3b88b6d6be6a3 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 9 Dec 2025 21:06:51 +0100 Subject: [PATCH 2/2] feat(applying-patch): improve some details Signed-off-by: Simon L. --- admin_manual/issues/applying_patch.rst | 38 +++++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/admin_manual/issues/applying_patch.rst b/admin_manual/issues/applying_patch.rst index 691717f6c..09ead5b21 100644 --- a/admin_manual/issues/applying_patch.rst +++ b/admin_manual/issues/applying_patch.rst @@ -2,27 +2,45 @@ Patching Nextcloud ================== +Obtaining a patch +----------------- + +If you found a related pull request on GitHub that solves your issue, or you want to help developers and verify a fix works, you can get a patch for the pull request. + +1. Using https://github.com/nextcloud/server/pull/26396 as an example. +2. Append ``.diff`` to the URL: https://github.com/nextcloud/server/pull/26396.diff +3. Download the patch to your server e.g. via ``wget https://github.com/nextcloud/server/pull/26396.diff`` (this will place ``26396.diff`` in the local directory) +4. Follow the `Applying a patch`_ steps. +5. If you are on an older Nextcloud version, you might first need to go to the correct backported patch for your version. + +.. image:: images/getting-a-patch-from-github.png + :alt: backportbot-nextcloud linking to the pull request for an older version. + +6. You can find the appropriate version by looking for a link posted by ``backportbot-nextcloud`` to the backport pull request for your release, or by checking for a developer comment with a manual backport link. Use the ``.diff`` URL of that backport PR. + Applying a patch ---------------- Patching server ^^^^^^^^^^^^^^^ -1. Navigate into your Nextcloud server's root directory (contains the ``status.php`` file) -2. Now apply the patch with the following command:: +1. Navigate to your Nextcloud server's root directory (the one that contains the ``status.php`` file). +2. Download the patch to your server e.g. via ``wget https://github.com/nextcloud/server/pull/26396.diff`` (this will place ``26396.diff`` in the local directory) +3. Apply the patch with the following command:: - patch -p 1 < /path/to/the/file.patch + patch -p 1 < ./26396.diff -3. Alternatively, if the patch command is not available, use:: +4. Alternatively, if the patch command is not available, use:: - git apply --check /path/to/the/file.diff - git apply /path/to/the/file.diff + git apply --check ./26396.diff + git apply ./26396.diff Patching apps ^^^^^^^^^^^^^ -1. Navigate to the root of this app (mostly ``apps/[APPID]/``), if you can not find the app there use the ``sudo -E -u www-data php occ app:getpath APPID`` command to find the path. -2. Now apply the patch with the same command as in `Patching server`_ +1. Navigate to the root of the app (usually ``apps/[APPID]/``). If you cannot find the app there, use the ``sudo -E -u www-data php occ app:getpath APPID`` command to find the path. +2. Download the patch to your server e.g. via ``wget https://github.com/nextcloud//pull/26396.diff`` (this will place ``26396.diff`` in the local directory) +3. Apply the patch with the same command as in `Patching server`_. Reverting a patch ----------------- @@ -30,11 +48,11 @@ Reverting a patch 1. Navigate to the directory where you applied the patch. 2. Now revert the patch with the ``-R`` option:: - patch -R -p 1 < /path/to/the/file.patch + patch -R -p 1 < ./26396.diff 3. Alternatively, if the patch command is not available, use:: - git apply --reverse /path/to/the/file.diff + git apply --reverse ./26396.diff Notes and troubleshooting -------------------------