update_patches.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. read -p "Press any key when the conflict have been resolved..." -n1 -s
  21. git add .
  22. git diff --staged -U1 > "${FILE}"
  23. fi
  24. git add .
  25. git reset -q --hard HEAD
  26. fi
  27. done
  28. if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
  29. for FILE in ../patches/insider/*.patch; do
  30. if [ -f "${FILE}" ]; then
  31. echo applying patch: "${FILE}"
  32. git apply --ignore-whitespace "${FILE}"
  33. if [ $? -ne 0 ]; then
  34. echo failed to apply patch "${FILE}"
  35. git apply --reject "${FILE}"
  36. read -p "Press any key when the conflict have been resolved..." -n1 -s
  37. git add .
  38. git diff --staged -U1 > "${FILE}"
  39. fi
  40. git add .
  41. git reset -q --hard HEAD
  42. fi
  43. done
  44. fi