2023-07-21 17:45:07 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-06-20 11:34:50 +03:00
|
|
|
|
2022-11-23 23:51:36 +03:00
|
|
|
export VSCODE_QUALITY="stable"
|
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
while getopts ":i" opt; do
|
2022-11-23 23:51:36 +03:00
|
|
|
case "$opt" in
|
|
|
|
i)
|
|
|
|
export VSCODE_QUALITY="insider"
|
|
|
|
;;
|
2023-07-21 17:45:07 +03:00
|
|
|
*)
|
|
|
|
;;
|
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}"
|
2022-06-20 11:34:50 +03:00
|
|
|
|
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"
|
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
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}"
|
2022-06-20 11:34:50 +03:00
|
|
|
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-02-26 16:53:49 +03:00
|
|
|
|
2024-10-13 21:16:48 +03:00
|
|
|
for ARCH in alpine linux osx windows; do
|
|
|
|
for FILE in "../patches/${ARCH}/"*.patch; do
|
|
|
|
check_file "${FILE}"
|
|
|
|
done
|
|
|
|
|
|
|
|
for FILE in "../patches/${ARCH}/"*/*.patch; do
|
|
|
|
check_file "${FILE}"
|
|
|
|
done
|
2024-02-26 16:53:49 +03:00
|
|
|
done
|