Mercurial > hg > soundsoftware-site
changeset 1550:7d825cbd76c8 feature_1136
Ensure we don't leave a git repo lying around for a repo with no corresponding (even if empty) authormap
author | Chris Cannam |
---|---|
date | Tue, 12 Jan 2016 17:22:27 +0000 |
parents | 28cde511f312 |
children | 36dddb6755f6 |
files | extra/soundsoftware/export-git.sh |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/soundsoftware/export-git.sh Tue Jan 12 17:32:54 2016 +0000 +++ b/extra/soundsoftware/export-git.sh Tue Jan 12 17:22:27 2016 +0000 @@ -48,12 +48,19 @@ set -u -authordir="$gitdir/AUTHORMAPS" - +authordir="$gitdir/__AUTHORMAPS" mkdir -p "$authordir" +wastedir="$gitdir/__WASTE" +mkdir -p "$wastedir" + echo "Extracting author maps..." +# Delete any existing authormap files, because we want to ensure we +# don't have an authormap for any project that was exportable but has +# become non-exportable (e.g. has gone private) +rm "$authordir/*" + "$rails" runner -e "$environment" "$progdir/create-repo-authormaps.rb" \ -s "$hgdir" -o "$authordir" @@ -70,6 +77,16 @@ if [ ! -f "$authormap" ]; then echo "No authormap file was created for repo $reponame, skipping" + + # If there is no authormap file, then we should not have a git + # mirror -- this is a form of access control, not just an + # optimisation (authormap files are expected to exist for all + # exportable projects, even if empty). So if a git mirror + # exists, we move it away + if [ -d "$gitrepo" ]; then + mv "$gitrepo" "$wastedir/$(date +%s).$reponame" + fi + continue fi