patch.sh 890 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. set -e
  3. echo "$#"
  4. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  5. git add .
  6. git reset -q --hard HEAD
  7. while [[ -n "$( git log -1 | grep "VSCODIUM HELPER" )" ]]; do
  8. git reset -q --hard HEAD~
  9. done
  10. git apply --reject "../patches/helper/settings.patch"
  11. while [ $# -gt 1 ]; do
  12. echo "Parameter: $1"
  13. if [[ "${1}" == *patch ]]; then
  14. FILE="../patches/${1}"
  15. else
  16. FILE="../patches/${1}.patch"
  17. fi
  18. git apply --reject "${FILE}"
  19. shift
  20. done
  21. git add .
  22. git commit --no-verify -q -m "VSCODIUM HELPER"
  23. if [[ "${1}" == *patch ]]; then
  24. FILE="../patches/${1}"
  25. else
  26. FILE="../patches/${1}.patch"
  27. fi
  28. if [[ -f "${FILE}" ]]; then
  29. git apply --reject "${FILE}" || true
  30. fi
  31. read -rp "Press any key when the conflict have been resolved..." -n1 -s
  32. git add .
  33. git diff --staged -U1 > "${FILE}"
  34. git reset -q --hard HEAD~
  35. echo "The patch has been generated."