From c7acc38504c1db4925b0f52684e83fa86cc4def0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 13 Dec 2024 21:26:59 +0200 Subject: Fix mrrepo script not to remove any repositories if no remote repositories mirroring enabled --- server/mrrepo | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'server') diff --git a/server/mrrepo b/server/mrrepo index 469a03f..056d101 100755 --- a/server/mrrepo +++ b/server/mrrepo @@ -16,6 +16,13 @@ # file. This file should be placed next to and will be sourced by the mrrepo # script (remember to adjust its permissions). # +# If the remote repositories mirroring is enabled ( argument is +# specified), then consider all subdirectories of with the .git +# extension, except for the local repositories, old mirrored remote +# repositories and remove them. Note that a git repository is local if it is +# referred to in the local manifest (public) or doesn't contain the +# git-daemon-export-ok file (private). +# # The manifest file line format (lines starting with # are ignored): # # [ ] @@ -234,23 +241,25 @@ if test -f manifest; then # Everything that is not in local is mirrored (or local private). # - for r in "${all[@]}"; do - - for i in "${local[@]}"; do - if [ "$i" = "$r" ]; then - if [ "$verb" -ge 1 ]; then - info "local public repository $r" + if [ -n "$host" ]; then + for r in "${all[@]}"; do + + for i in "${local[@]}"; do + if [ "$i" = "$r" ]; then + if [ "$verb" -ge 1 ]; then + info "local public repository $r" + fi + r= + break fi - r= - break + done + + if [ -n "$r" ]; then + mirror+=("$r") fi done - - if [ -n "$r" ]; then - mirror+=("$r") - fi - done -else + fi +elif [ -n "$host" ]; then mirror=("${all[@]}") fi -- cgit v1.1