update_patches.sh 1.4 KB

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