From e2cc4ffe308a64e5a731c5a911ef4b8ebb6ea4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Thu, 5 Dec 2024 16:59:29 +0100 Subject: [PATCH] Have script handle same-ver patches --- upstream/gen_patch.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/upstream/gen_patch.sh b/upstream/gen_patch.sh index 139ac7c8e..96535b4db 100644 --- a/upstream/gen_patch.sh +++ b/upstream/gen_patch.sh @@ -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}" @@ -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"