diff options
author | Erich Eckner <git@eckner.net> | 2019-05-29 14:41:09 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-05-29 14:41:09 +0200 |
commit | 1fd5b95798896930cf78eb96e1644b59f684a627 (patch) | |
tree | b20ae0750c71c7dea2377527f613bd8c8db76c82 | |
parent | 5df59f3be51dfc707170bff1f37d2bec6780e766 (diff) | |
download | gitolite-sync-1fd5b95798896930cf78eb96e1644b59f684a627.tar.xz |
gitolite-sync: fix some bugs
-rwxr-xr-x | gitolite-sync | 16 |
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 |