X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/e905a477887c2b36114f465dd7e82b032903bb3c..03e18ae17a72f3db72ee65eb290d35fb13d66237:/zsh/lib/chpwd.zsh diff --git a/zsh/lib/chpwd.zsh b/zsh/lib/chpwd.zsh index 1763cd5..33ca200 100644 --- a/zsh/lib/chpwd.zsh +++ b/zsh/lib/chpwd.zsh @@ -1,7 +1,16 @@ function git_auto_fetch { # auto git fetch on intervals if [[ -d .git ]] || git rev-parse --git-dir 2>/dev/null 1>&2; then - ((interval = 24 * 60 * 60)) # 1 day + # read interval or store default + local -i interval + if ! interval=$(git config custom.fetch-interval); then + ((interval = 24 * 60 * 60)) # 1 day + git config custom.fetch-interval $interval + fi + + # Don't fetch if interval is <= 0 + (( $interval <= 0 )) && return + local -i time=$(date -u +%s) local -i fetch_time=$(git config custom.fetch-time) if (( $time - $fetch_time > $interval )); then