update_patches.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. export VSCODE_QUALITY="stable"
  3. while getopts ":i" opt; do
  4. case "$opt" in
  5. i)
  6. export VSCODE_QUALITY="insider"
  7. ;;
  8. *)
  9. ;;
  10. esac
  11. done
  12. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  13. git add .
  14. git reset -q --hard HEAD
  15. for FILE in ../patches/*.patch; do
  16. if [[ -f "${FILE}" ]]; then
  17. echo applying patch: "${FILE}"
  18. if ! git apply --ignore-whitespace "${FILE}"; then
  19. echo failed to apply patch "${FILE}"
  20. git apply --reject "${FILE}"
  21. git apply --reject "../patches/helper/settings.patch"
  22. read -rp "Press any key when the conflict have been resolved..." -n1 -s
  23. git restore .vscode/settings.json
  24. git add .
  25. git diff --staged -U1 > "${FILE}"
  26. fi
  27. git add .
  28. git reset -q --hard HEAD
  29. fi
  30. done
  31. if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
  32. for FILE in ../patches/insider/*.patch; do
  33. if [[ -f "${FILE}" ]]; then
  34. echo applying patch: "${FILE}"
  35. if ! git apply --ignore-whitespace "${FILE}"; then
  36. echo failed to apply patch "${FILE}"
  37. git apply --reject "${FILE}"
  38. git apply --reject "../patches/helper/settings.patch"
  39. read -rp "Press any key when the conflict have been resolved..." -n1 -s
  40. git restore .vscode/settings.json
  41. git add .
  42. git diff --staged -U1 > "${FILE}"
  43. fi
  44. git add .
  45. git reset -q --hard HEAD
  46. fi
  47. done
  48. fi