Specification for apply_patch.cs usage extended with suggestions from Codex.

This commit is contained in:
Marek Lemańczyk committed 2025-10-03 20:44:22 +02:00
1 parent 16a79f33a9
commit 596ee76a2d
1 file changed
+6
+6
View File
@@ -25,6 +25,12 @@ dotnet script apply_patch.cs -- <patch-file> [target-directory]
It supports the standard `git diff` patch files as input. You should be able to run it both in the local and remote `Codex` environments. You should expect it to work both in `Windows` and `Linux` environments. Make sure that you include `diff --git` lines, headers and file prefixes in the patch files to avoid applying issues.
* Build patches in small, line-precise hunks; confirm target lines with Get-Content before writing the diff to avoid context mismatches.
* Regenerate the diff whenever the file shifts—never reuse an old hunk after other edits.
* Keep patch filenames unique and delete applied files to prevent accidental re-use.
* When a hunk fails, inspect the around-lines immediately and adjust rather than retrying the same diff.
* Prefer single-purpose patches (one logical change per file) so rollbacks or fixes stay focused.
If you want to make any changes, create a patch file and run the script to apply it. Always run it from the root directory and reference any modified files with relative paths respectively in the patch.
Do **not** attempt to apply the changes manually, or with `Python`, or with `PowerShell` scripts, or `cat` or any other way, unless you apply changes to `apply_patch.cs` script itself. If you identify any issues with `apply_patch.cs` script, you should propose fixes to resolve them and continue using the script after updates. If you spot any missing, but required features, propose enhancements and continue using the script after updates, too.