openobservation_setup.sh 813 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # A `realpath` alternative using the default C implementation.
  3. filepath() {
  4. [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
  5. }
  6. REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
  7. clone_checkout_openobservation() {
  8. cd $REPO_ROOT
  9. revision=$(Scripts/CI/get_revision.sh openobservation)
  10. cd ..
  11. if [ ! -d OpenObservation ]; then
  12. gh repo clone OpenSwiftUIProject/OpenObservation
  13. cd OpenObservation
  14. else
  15. echo "OpenObservation already exists, skipping clone."
  16. cd OpenObservation
  17. git fetch --all --quiet
  18. git stash --quiet || true
  19. git reset --hard --quiet origin/main
  20. fi
  21. if [ -n "$revision" ]; then
  22. git checkout --quiet "$revision"
  23. else
  24. echo "No pinned revision for OpenObservation, using default branch."
  25. fi
  26. }
  27. clone_checkout_openobservation