Skip to content

Commit

Permalink
Have script handle same-ver patches
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Dec 5, 2024
1 parent a2d8210 commit e2cc4ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions upstream/gen_patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

D_MERLIN=../src/ocaml

FROM=502
FROM=503
TO=503

D_FROM=ocaml_${FROM}
D_TO=ocaml_${TO}
D_PATCH=patches_${TO}
D_PATCH=patches__${TO}

mkdir "${D_PATCH}"

Expand All @@ -18,7 +18,11 @@ for file in "${D_TO}"/*/*.ml*; do
F_PATCH=$(echo "${F_TO}" | sed "s/${D_TO}/${D_PATCH}/g")
mkdir "$(dirname "${F_PATCH}")" 2>/dev/null | true
# Make diff
diff -u -N "${F_FROM}" "${F_TO}" >"${F_PATCH}.patch"
if [ "$F_FROM" = "$F_TO" ]; then
git diff "${F_FROM}" >"${F_PATCH}.patch"
else
diff -u -N "${F_FROM}" "${F_TO}" >"${F_PATCH}.patch"
fi
if [ -s "${F_PATCH}.patch" ]; then
# Apply the patch file
patch --no-backup-if-mismatch --merge "${F_MERLIN}" "${F_PATCH}.patch"
Expand Down

0 comments on commit e2cc4ff

Please sign in to comment.