mirror of https://github.com/akelge/zsh
17 lines
379 B
Bash
17 lines
379 B
Bash
zmodload -F zsh/stat b:zstat
|
|
zmodload zsh/datetime
|
|
local _gitdir
|
|
local last_fetch
|
|
local diff
|
|
|
|
cd $1
|
|
|
|
_gitdir=$(git rev-parse --git-dir 2> /dev/null) || return 0
|
|
last_fetch=$(zstat +mtime $_gitdir/FETCH_HEAD 2> /dev/null || echo 0)
|
|
let "diff = $(strftime %s)- $last_fetch"
|
|
[ $diff -gt ${GIT_FETCH_INTERVAL:-30} ] && git fetch --all -p
|
|
|
|
return 0
|
|
|
|
# vim: set ts=2 sw=2 tw=0 ft=sh :
|