github.com/Tri-stone/burrow@v0.25.0/scripts/git_get_revision.sh (about)

     1  #!/usr/bin/env bash
     2  # Gives us a non-zero exit code if there are tracked or untracked changes in the working
     3  # directory
     4  REPO="$1"
     5  PROJECT_PATH="$2"
     6  REVISION="$3"
     7  
     8  # Do initial checkout if it doesn't exist
     9  $(cd "$PROJECT_PATH" 2> /dev/null) || git clone ${REPO} ${PROJECT_PATH}
    10  pushd "$PROJECT_PATH"
    11  # Attempt to checkout the specified revision
    12  git fetch --all
    13  git checkout ${REVISION}
    14  popd