cmd/update: stop Git's fsmonitor when needed

Git's fsmonitor daemon will prevent our update lock file from being
released if it is running before a `brew update`.

Let's fix that by stopping it whenever necessary so our update lock is
released upon completion.

Fixes #13521.
This commit is contained in:
Carlo Cabrera 2022-07-20 18:18:12 +08:00
parent 8a2efb1df6
commit f9e8531924
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -556,6 +556,12 @@ EOS
[[ -d "${DIR}/.git" ]] || continue
cd "${DIR}" || continue
# Git's fsmonitor daemon will not release our lock unless we stop it.
if git fsmonitor--daemon status &>/dev/null
then
git fsmonitor--daemon stop 2>/dev/null
fi
if ! git config --local --get remote.origin.url &>/dev/null
then
opoo "No remote 'origin' in ${DIR}, skipping update!"