Без опису

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. set -eu
  3. main_repo=$(pwd)
  4. git_save() {
  5. status=$(git status -s)
  6. if [ "$status" ]; then
  7. git stash push --include-untracked
  8. return 0
  9. else
  10. set +e
  11. return 1
  12. fi
  13. }
  14. git_restore() {
  15. if [ $1 -eq 0 ]; then
  16. git stash pop
  17. fi
  18. }
  19. # update main
  20. git pull
  21. # update battle_engine
  22. echo "*** Updating Battle Engine repository ***"
  23. cd $main_repo/battle_engine
  24. git_save
  25. result=$?
  26. set -e
  27. git checkout master
  28. git pull
  29. git_restore $result
  30. # update g3headers
  31. echo "*** Updating g3headers repository ***"
  32. cd $main_repo/g3headers
  33. git_save
  34. result=$?
  35. set -e
  36. git checkout master
  37. git pull
  38. git_restore $result
  39. # update private
  40. echo "*** Updating private repository ***"
  41. cd $main_repo/sots-private
  42. git_save
  43. result=$?
  44. set -e
  45. git checkout master
  46. git pull
  47. git_restore $result