diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2021-09-10 20:10:26 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2021-09-10 20:10:26 -0600 |
commit | 3c73976ef306d68a85d60c94be9a1dcdc33fa2bf (patch) | |
tree | 619ba4b5874b92ada9dc089c67a435dd3149748a /plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | |
parent | f8b7b6584bf1ca7e836ba9cc13fcce573047fb07 (diff) | |
parent | 735808f48d54aabce540f6c90294e21118104cf4 (diff) | |
download | zsh-3c73976ef306d68a85d60c94be9a1dcdc33fa2bf.tar.gz zsh-3c73976ef306d68a85d60c94be9a1dcdc33fa2bf.tar.bz2 zsh-3c73976ef306d68a85d60c94be9a1dcdc33fa2bf.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/git-auto-fetch/git-auto-fetch.plugin.zsh')
-rw-r--r-- | plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 8 |
1 files changed, 5 insertions, 3 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..efe8cbe66 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 @@ -24,8 +25,9 @@ function git-fetch-all { fi # Fetch all remotes (avoid ssh passphrase prompt) + date -R &>! "$gitdir/FETCH_LOG" GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \ - command git fetch --all 2>/dev/null &>! "$gitdir/FETCH_LOG" + command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG" ) &| } |