1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

fix(git-auto-fetch): cancel fetch if we don't have permission over git folder (#10010)

This commit is contained in:
Xuehai Pan 2021-09-06 23:46:56 +08:00 committed by GitHub
parent 5a4159cd29
commit ab8b9913cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,8 +11,9 @@ function git-fetch-all {
return 0
fi
# Do nothing if auto-fetch disabled
if [[ -z "$gitdir" || -f "$gitdir/NO_AUTO_FETCH" ]]; then
# Do nothing if auto-fetch is disabled or don't have permissions
if [[ ! -w "$gitdir" || -f "$gitdir/NO_AUTO_FETCH" ]] ||
[[ -f "$gitdir/FETCH_LOG" && ! -w "$gitdir/FETCH_LOG" ]]; then
return 0
fi