Fix: Upgrade global-jjb to v0.90.7
[releng/builder.git] / jjb / autorelease / autorelease-checkout-gerrit-patch.sh
1 #!/bin/bash -l
2 set -eu -o pipefail
3
4 # If the project is autorelease then we do not need to cd
5 if [ "$GERRIT_PROJECT" != "releng/autorelease" ]; then
6     cd "$WORKSPACE/$GERRIT_PROJECT"
7 fi
8
9 echo "Checking out ${GERRIT_PROJECT} patch ${GERRIT_REFSPEC}..."
10 git fetch origin "${GERRIT_REFSPEC}" && git checkout FETCH_HEAD
11
12 # If the project is autorelease then we need to init and update submodules
13 if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
14     git submodule update --init
15     # The previous checkout might have failed to remove directory of a submodule being removed.
16     # See https://stackoverflow.com/a/10761699
17     git clean -dff
18 fi