vscodium/build/update_patches.sh

61 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
2022-11-23 20:51:36 +00:00
export VSCODE_QUALITY="stable"
while getopts ":ilp" opt; do
case "$opt" in
i)
export VSCODE_QUALITY="insider"
;;
esac
done
cd vscode || { echo "'vscode' dir not found"; exit 1; }
git add .
git reset -q --hard HEAD
2022-11-17 21:56:46 +00:00
for FILE in ../patches/*.patch; do
if [ -f "${FILE}" ]; then
echo applying patch: "${FILE}"
git apply --ignore-whitespace "${FILE}"
if [ $? -ne 0 ]; then
2022-11-17 21:56:46 +00:00
echo failed to apply patch "${FILE}"
2023-03-02 22:23:03 +00:00
2022-11-17 21:56:46 +00:00
git apply --reject "${FILE}"
2023-03-02 22:23:03 +00:00
git apply --reject "../patches/helper/settings.patch"
read -p "Press any key when the conflict have been resolved..." -n1 -s
2023-03-02 22:23:03 +00:00
git restore .vscode/settings.json
2022-11-17 21:56:46 +00:00
git add .
git diff --staged -U1 > "${FILE}"
fi
git add .
git reset -q --hard HEAD
fi
done
2022-11-23 20:51:36 +00:00
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
for FILE in ../patches/insider/*.patch; do
if [ -f "${FILE}" ]; then
echo applying patch: "${FILE}"
git apply --ignore-whitespace "${FILE}"
if [ $? -ne 0 ]; then
echo failed to apply patch "${FILE}"
2023-03-02 22:23:03 +00:00
2022-11-23 20:51:36 +00:00
git apply --reject "${FILE}"
2023-03-02 22:23:03 +00:00
git apply --reject "../patches/helper/settings.patch"
2022-11-23 20:51:36 +00:00
read -p "Press any key when the conflict have been resolved..." -n1 -s
2023-03-02 22:23:03 +00:00
git restore .vscode/settings.json
2022-11-23 20:51:36 +00:00
git add .
git diff --staged -U1 > "${FILE}"
fi
git add .
git reset -q --hard HEAD
fi
done
fi