move cache cleanup back to before cache creation
It was moved to avoid a race, but that's now avoided in another way. I prefer having it here, because this way if it somehow fails and deletes the locpath that is going to be used, at least it will get re-created.
This commit is contained in:
parent
224623e72e
commit
d479a885de
1 changed files with 8 additions and 8 deletions
|
@ -142,6 +142,14 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
|
|||
LOCPATH="$HOME/.cache/git-annex/locales/$locpathbase"
|
||||
export LOCPATH
|
||||
|
||||
# Clean up locale caches when their standalone bundle no longer exists.
|
||||
for localecache in $HOME/.cache/git-annex/locales/*; do
|
||||
cachebase=$(cat "$localecache/base" 2>/dev/null || true)
|
||||
if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then
|
||||
rm -rf "$localecache" >/dev/null 2>&1 || true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "$LOCPATH" ]; then
|
||||
locpathtmp="$HOME/.cache/git-annex/locales.tmp/$locpathbase.$$"
|
||||
if ! mkdir -p "$locpathtmp"; then
|
||||
|
@ -183,14 +191,6 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
|
|||
# in which cache the mv above would put it here.
|
||||
rm -rf "$LOCPATH/$locpathbase.$$"
|
||||
fi
|
||||
|
||||
# Clean up locale caches when their standalone bundle no longer exists.
|
||||
for localecache in $HOME/.cache/git-annex/locales/*; do
|
||||
cachebase=$(cat "$localecache/base" 2>/dev/null || true)
|
||||
if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then
|
||||
rm -rf "$localecache" >/dev/null 2>&1 || true
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
useproot=""
|
||||
|
|
Loading…
Reference in a new issue