openobservation_setup.sh 816 B

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