# HG changeset patch # User Chris Cannam # Date 1452619347 0 # Node ID 7d825cbd76c8ac71650f666cb2b2924fbc6d1a00 # Parent 28cde511f31295397089f54a29d420fc479cf552 Ensure we don't leave a git repo lying around for a repo with no corresponding (even if empty) authormap diff -r 28cde511f312 -r 7d825cbd76c8 extra/soundsoftware/export-git.sh --- 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