summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-29 14:41:09 +0200
committerErich Eckner <git@eckner.net>2019-05-29 14:41:09 +0200
commit1fd5b95798896930cf78eb96e1644b59f684a627 (patch)
treeb20ae0750c71c7dea2377527f613bd8c8db76c82
parent5df59f3be51dfc707170bff1f37d2bec6780e766 (diff)
downloadgitolite-sync-1fd5b95798896930cf78eb96e1644b59f684a627.tar.xz
gitolite-sync: fix some bugs
-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