1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-12 08:50:08 +00:00
ohmyzsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh

16 lines
473 B
Bash
Raw Normal View History

2016-09-29 16:05:49 +00:00
function git_fetch_on_chpwd {
2016-10-04 18:26:19 +00:00
([[ -d .git ]] && [[ ! -f ".git/NO_AUTO_FETCH" ]] && git fetch --all &>! .git/FETCH_LOG &)
}
function git-auto-fetch {
[[ ! -d .git ]] && return
if [[ -f ".git/NO_AUTO_FETCH" ]]; then
2016-10-06 13:55:21 +00:00
rm ".git/NO_AUTO_FETCH" && echo "${fg_bold[red]}disabled${reset_color}"
2016-10-04 18:26:19 +00:00
else
2016-10-06 13:55:21 +00:00
touch ".git/NO_AUTO_FETCH" && echo "${fg_bold[green]}enabled${reset_color}"
2016-10-04 18:26:19 +00:00
fi
2016-09-29 16:05:49 +00:00
}
2016-09-29 19:14:04 +00:00
chpwd_functions+=(git_fetch_on_chpwd)
git_fetch_on_chpwd
2016-10-04 18:26:19 +00:00
unset git_fetch_on_chpwd