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