blob: efd85ab080637cc6dd58301d38fe0dd0dc83e2c2 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/bash
if [ $# -eq 1 ]; then
if [ "$1" == "--help" ]; then
>&2 echo \
'Usage: gitolite-sync [options]
Synchronize the git repository $GL_REPO in $GIT_DIR.
This can be used as a post-receive hook in gitolite to sync with other repositories.
Options:
#HELPTEXT# #'
exit
elif [ "$1" == "--version" ]; then
echo '#VERSION#'
exit
fi
fi
if [ $# -ne 0 ]; then
>&2 echo 'too many arguments'
exit 1
fi
declare -A default_remotes
. "#ETCDIR#/gitolite-sync.conf"
for remote in "${!default_remotes[@]}"; do
if git -C "${GIT_DIR}" remote \
| grep -qxF "${remote}"; then
continue
fi
git -C "${GIT_DIR}" remote add "${remote}" "${default_remotes["${remote}"]}${GL_REPO}.git"
done
for remote in "${sync_remotes[@]}"; do
git -C "${GIT_DIR}" remote \
| grep -qxF "${remote}" \
|| continue
git -C "${GIT_DIR}" push "${remote}" 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
done
|