31 lines
748 B
Bash
31 lines
748 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$root"
|
|
fetch_repo() {
|
|
local repo="$1"
|
|
local branch="$2"
|
|
local dir="$3"
|
|
if [ -d "$dir" ]; then
|
|
git -C "$dir" rev-parse --is-inside-work-tree >/dev/null
|
|
git -C "$dir" remote set-url origin "$repo"
|
|
git -C "$dir" fetch origin "$branch"
|
|
git -C "$dir" checkout "$branch"
|
|
git -C "$dir" pull --ff-only origin "$branch"
|
|
else
|
|
git clone --branch "$branch" --single-branch "$repo" "$dir"
|
|
fi
|
|
}
|
|
|
|
fetch_repo_ex() {
|
|
local name="$1"
|
|
repo="http://192.168.1.75:3000/psc/${name}"
|
|
branch="master"
|
|
fetch_repo "${repo}" "$branch" "third_party/${name}"
|
|
}
|
|
|
|
fetch_repo_ex "build_infra"
|
|
fetch_repo_ex "CPP_Core"
|
|
fetch_repo_ex "SSR"
|