diff options
author | Xuehai Pan <XuehaiPan@outlook.com> | 2021-09-06 23:46:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-06 17:46:56 +0200 |
commit | ab8b9913cb6cba35da3126887d4c0b67f033fffa (patch) | |
tree | b6b6cab9de62cb349356f81af9f56b04f41ff700 /plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | |
parent | 5a4159cd29ab9dfa31e7747dd676f3cf0e19bf81 (diff) | |
download | zsh-ab8b9913cb6cba35da3126887d4c0b67f033fffa.tar.gz zsh-ab8b9913cb6cba35da3126887d4c0b67f033fffa.tar.bz2 zsh-ab8b9913cb6cba35da3126887d4c0b67f033fffa.zip |
fix(git-auto-fetch): cancel fetch if we don't have permission over git folder (#10010)
Diffstat (limited to 'plugins/git-auto-fetch/git-auto-fetch.plugin.zsh')
-rw-r--r-- | plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 0da84f2f5..dbc949621 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -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 |