You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrote and tested a little bash script to generate .old files.
The script has to live in the patches folder for convenience.
It will iterate through all patch files create original files.
This way one can modify the sources again and and run vendor/bin/vendor-patches generate
#!/bin/bash
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")"&& pwd)"
patch_dir="$script_dir"
vendor_dir="$script_dir/../vendor"forpatch_filein"$patch_dir"/*.patch;doecho""echo"patch: $patch_file"# Extract the first two components of the patch file name for the base directory
target_folder=$(basename "$patch_file"| cut -d'-' -f1,2 | tr '-''/')# Read the new file path from the patch file's '+++' line and extract the path part only
target_file_path_from_patch=$(grep '^\+\+\+'"$patch_file"| head -n 1 | sed -e 's/^\+\+\+ \(.*\)/\1/' -e 's/^\.\.\///')
full_target_path="$vendor_dir/$target_folder/$target_file_path_from_patch"
backup_file_path="${full_target_path}.old"# Apply the reverse patch to the target file and save as .oldif [ -f"$full_target_path" ];then
cp "$full_target_path""$backup_file_path"
patch "$backup_file_path""$patch_file" --reverse
elseecho"Target file does not exist:"echo" - $full_target_path"fidone
Brainstorming a possible flow:
Option 1
Option 2 (Ideal)
The text was updated successfully, but these errors were encountered: