aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/osmo-deps.sh
blob: 5a7dcc275fbcbc855dc42251342c29fae8d34d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/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


if ! test -d "$project";
then
  git clone "git://git.osmocom.org/$project" "$project"
fi

cd "$project"
git fetch --tags origin
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