osmo-ci/scripts/osmo-deps.sh

27 lines
719 B
Bash
Raw Normal View History

2016-04-24 09:24:30 +00:00
#!/bin/sh
. "$(dirname "$0")/common.sh"
set -ex
project="$1"
branch="${2:-master}"
# If ref is really a branch, we want to track the remote one:
if [ "x$(git branch -a | grep -c "remotes/origin/$branch\$")" != "x0" ]; then
branch="origin/$branch"
fi
2016-04-24 09:24:30 +00:00
if ! test -d "$project"; then
git clone "$(osmo_git_clone_url "$project")" "$project"
2016-04-24 09:24:30 +00:00
fi
cd "$project"
git fetch --tags origin
2016-04-24 09:24:30 +00:00
git fetch origin
# Cleanup should already have happened during a global osmo-clean-workspace.sh,
# but in case the caller did not (want to) call that, let's also do cleanup in
# this dep subdir separately, making sure to not pass in $deps as abspath.
deps="" osmo-clean-workspace.sh
git checkout -f "$branch"
git rev-parse HEAD