diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-12-13 21:26:59 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-12-17 10:52:14 +0200 |
commit | c7acc38504c1db4925b0f52684e83fa86cc4def0 (patch) | |
tree | 207b0ec3aa8140f38b72bcd1b078a5a30d72a591 | |
parent | 144385cd9b6046e6236041f96586175ae12a19c7 (diff) |
Fix mrrepo script not to remove any repositories if no remote repositories mirroring enabledHEADmaster
-rwxr-xr-x | server/mrrepo | 37 |
1 files changed, 23 insertions, 14 deletions
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 (<host> argument is +# specified), then consider all subdirectories of <path> 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): # # <repository-path>[ <remote-mirror-url>] @@ -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 |