1
0
mirror of https://github.com/akelge/zsh synced 2025-07-14 17:52:09 +00:00
Files
zsh/zsh.d/zshfunctions/gitfetch
Andrea Mistrali ca8a24d28e remove zwc files, add gitfetch function
Also load modules for stat and time;
Fix status typos
2021-12-16 08:54:17 +01:00

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 :