-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgit-pull.sh
More file actions
executable file
·75 lines (65 loc) · 1.32 KB
/
git-pull.sh
File metadata and controls
executable file
·75 lines (65 loc) · 1.32 KB
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
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
GITHUB_URLS=(
"git@github.com:slipstream"
"https://github.com/slipstream"
)
REPOS=(
"SlipStreamUI"
"SlipStreamWebUI"
"SlipStreamServer"
"SlipStreamServerDeps"
"SlipStreamClient"
"SlipStreamClojureAPI"
"SlipStreamConnectors"
"SlipStreamPythonAPI"
"SlipStreamJobEngine"
"SlipStreamParent"
"SlipStreamTests"
# add enterprise-only repositories here -- do not remove this comment
"SlipStreamConnectorsEnterprise"
"SlipStreamServerEnterprise"
)
# loop over possible repository locations for cloning
clone_ss_repo(){
repo=${1}
for i in "${GITHUB_URLS[@]}"
do
repo_url=${i}/${repo}.git
echo "Cloning ${repo_url}"
git clone ${repo_url}
rc=$?
if [ ${rc} -eq 0 ]
then
break;
else
echo "Cloning ${repo_url} failed!"
fi
done
return ${rc}
}
# Update or clone the given repository.
update_ss_repo(){
repo=${1}
rc=0
if [ -d ${repo} ]
then
echo "Updating ${repo}..."
(cd ${repo}; git rev-parse --abbrev-ref HEAD; git pull)
rc=$?
else
echo "Repo ${repo} is not yet cloned here."
clone_ss_repo ${repo}
rc=$?
fi
if [ ${rc} -ne 0 ]
then
echo "Clone of ${repo} failed."
exit ${rc}
fi
}
# Loop through all requested repositories and update or clone.
for repo in ${REPOS[@]}
do
update_ss_repo ${repo}
echo
done