-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fetch_externals.sh
executable file
·65 lines (55 loc) · 1.27 KB
/
fetch_externals.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
OUTDIR="external"
libraries=(
'catch2'
'fmt'
'json-schema-validator'
'nlohmann'
'stduuid'
)
repositories=(
'catchorg/Catch2'
'fmtlib/fmt'
'chalet-org/json-schema-validator'
'nlohmann/json'
'mariusbancila/stduuid'
)
tags=(
'v2.x'
'10.1.1'
'chalet_v0.8.0'
'v3.10.2'
'v1.2.2'
)
commits=(
0
0
0
0
0
)
printf "Fetching dependencies into '$OUTDIR'...\n\n"
# git clone [--quiet] -b [tag|branch] [--single-branch|--depth 1] --config advice.detatchedHead=false (repo) (destination)
color='\033[1;35m'
color_reset='\033[0m'
fetching_symbol='➥'
# use --single-branch if pulling specific commit
for idx in 0 1 2 3 4 5 6 7 8 9 10; do
library=${libraries[$idx]}
repo=${repositories[$idx]}
tag=${tags[$idx]}
single_commit=${commits[$idx]}
path="$OUTDIR/$library"
if [[ ! -d "$path" ]]; then
printf "$color$fetching_symbol Fetching: $repo ($tag)$color_reset\n"
mkdir -p "$path"
if [[ "$single_commit" == "1" ]]; then
git clone --quiet --single-branch --config "advice.detachedHead=false" "https://github.com/$repo.git" "$path"
git -C "$path" reset --quiet --hard "$tag"
else
git clone --quiet -b "$tag" --depth 1 --config "advice.detachedHead=false" "https://github.com/$repo.git" "$path"
fi
rm -rf "$path/.git/"
fi
done
printf "\n"