From 1fd5b95798896930cf78eb96e1644b59f684a627 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 29 May 2019 14:41:09 +0200 Subject: gitolite-sync: fix some bugs --- gitolite-sync | 16 +++++++++++++--- 1 file 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 -- cgit v1.2.3-70-g09d2