summaryrefslogtreecommitdiff
path: root/gitolite-sync.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-09-11 14:31:55 +0200
committerErich Eckner <git@eckner.net>2019-09-11 14:31:55 +0200
commitec18d30b65fbe2da859648171fa3d77bccad8029 (patch)
tree07d70ee7a13fc400114f0ab2495f92e3ee6ef88c /gitolite-sync.in
parent585353d2ca9d9355cb4e7097f1c173a3a95f330d (diff)
downloadgitolite-sync-ec18d30b65fbe2da859648171fa3d77bccad8029.tar.xz
gitolite-sync: create default remote if no remote was set up so far
Diffstat (limited to 'gitolite-sync.in')
-rw-r--r--gitolite-sync.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/gitolite-sync.in b/gitolite-sync.in
index 067b87a..9c7bdf0 100644
--- a/gitolite-sync.in
+++ b/gitolite-sync.in
@@ -51,9 +51,13 @@ for repository_dir in "${repository_dirs[@]}"; do
| sort -u
)
if [ -z "${remotes}" ]; then
- >&2 printf 'Repository "%s" has no backup remotes.\n' \
- "${path}"
- continue
+ >&2 printf 'adding default remote "%s", because no remote was found so far\n' \
+ "${default_remote_name}"
+ git -C "${path}" remote add "${default_remote_name}" "$(
+ printf '%s\n' "${path}" \
+ | sed "${default_remote_path_substitution}"
+ )"
+ remotes="${default_remote_name}"
fi
for remote in ${remotes}; do
git -C "${path}" fetch "${remote}" 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'