diff options
author | Leif Lindholm <leif.lindholm@linaro.org> | 2017-11-29 14:15:21 +0000 |
---|---|---|
committer | Leif Lindholm <leif.lindholm@linaro.org> | 2017-11-29 14:15:21 +0000 |
commit | 918ff7371d670515d71bf8f40ddfaff5d10c3b6d (patch) | |
tree | 9bae7dd666532245d996632e9f859ac4f762b7f4 | |
parent | 0573f65f48c4fd0b6351b128ecc43dd015410c28 (diff) |
build.sh: fix repo reset on clone
The script failed to reset to the desired commit when cloning.
Fixed that.
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
-rwxr-xr-x | build.sh | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -74,19 +74,26 @@ update_repo() cd - } +clone_repo() +{ + set_current_repo $1 + + echo git clone $REPO_ORIGIN + git clone $REPO_ORIGIN + + cd $1 + git reset --hard $REPO_HASH + [ $? -ne 0 ] && echo "Failed to reset '$1' to '$REPO_HASH'!" >&2 && exit 1 + cd - +} + get_repo() { TARGET_DIR=$1 if [ -d $TARGET_DIR ]; then update_repo $TARGET_DIR - if [ $? -ne 0 ]; then - echo "Failed to obtain specified version of '$TARGET_DIR'" >&2 - exit 1 - fi else - set_current_repo $1 - echo git clone $REPO_ORIGIN - git clone $REPO_ORIGIN + clone_repo $TARGET_DIR fi } |