vscodium/build/update_patches.sh

53 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-11-23 23:51:36 +03:00
export VSCODE_QUALITY="stable"
while getopts ":i" opt; do
2022-11-23 23:51:36 +03:00
case "$opt" in
i)
export VSCODE_QUALITY="insider"
;;
*)
;;
2022-11-23 23:51:36 +03:00
esac
done
2024-08-12 13:04:31 +03:00
check_file() {
if [[ -f "${1}" ]]; then
echo applying patch: "${1}"
if ! git apply --ignore-whitespace "${1}"; then
echo failed to apply patch "${1}"
2024-08-12 13:04:31 +03:00
git apply --reject "${1}"
2023-03-03 01:23:03 +03:00
git apply --reject "../patches/helper/settings.patch"
read -rp "Press any key when the conflict have been resolved..." -n1 -s
2023-03-03 01:23:03 +03:00
git restore .vscode/settings.json
2022-11-18 00:56:46 +03:00
git add .
2024-08-12 13:04:31 +03:00
git diff --staged -U1 > "${1}"
fi
git add .
git reset -q --hard HEAD
fi
2024-08-12 13:04:31 +03:00
}
2022-11-23 23:51:36 +03:00
2024-08-12 13:04:31 +03:00
cd vscode || { echo "'vscode' dir not found"; exit 1; }
2023-03-03 01:23:03 +03:00
2024-08-12 13:04:31 +03:00
git add .
git reset -q --hard HEAD
2023-03-03 01:23:03 +03:00
2024-08-12 13:04:31 +03:00
for FILE in ../patches/*.patch; do
check_file "${FILE}"
done
2023-03-03 01:23:03 +03:00
2024-08-12 13:04:31 +03:00
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
for FILE in ../patches/insider/*.patch; do
check_file "${FILE}"
2022-11-23 23:51:36 +03:00
done
fi
2024-08-12 13:04:31 +03:00
for FILE in ../patches/linux/*/*.patch; do
check_file "${FILE}"
done