summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgitolite-sync16
1 files changed, 13 insertions, 3 deletions
diff --git a/gitolite-sync b/gitolite-sync
index 8bedcd2..1ee7cac 100755
--- a/gitolite-sync
+++ b/gitolite-sync
@@ -31,8 +31,12 @@ find "${home}/repositories" \
git -C "${path}" fetch "${remote}" -p
done
branches=$(
- git -C "${path}" branch --list \
- | sed 's/^.\s//'
+ git -C "${path}" branch --all \
+ | sed '
+ s,^.\sremotes/[^/[:space:]]\+/,,
+ t
+ d
+ '
)
if [ -n "$(git -C "${path}" tag -l)" ]; then
has_tags=true
@@ -46,12 +50,18 @@ find "${home}/repositories" \
fi
for remote in ${remotes}; do
if ${has_tags}; then
- git -C "${path}" push --tags
+ git -C "${path}" push "${remote}" --tags
fi
if [ -z "${branches}" ]; then
continue
fi
for branch in ${branches}; do
+ if ! git -C "${path}" branch \
+ | sed 's/^.\s//' \
+ | grep -qxF "${branch}"; then
+ git -C "${path}" branch "${branch}" --track "${remote}/${branch}"
+ fi
+ git -C "${path}" pull --ff-only "${remote}" "${branch}" 2>/dev/null
git -C "${path}" push "${remote}" "${branch}"
done
done