1
0
mirror of https://github.com/akelge/zsh synced 2025-07-03 05:05:28 +00:00

Fix prompts and a minor alignment in gitfetch

This commit is contained in:
2021-12-21 07:59:31 +01:00
parent 4a7b17c07b
commit 8d0b2db580
3 changed files with 39 additions and 30 deletions

View File

@ -2,13 +2,18 @@ local _gitdir
local last_fetch
local diff
# exec 3>&1 4>&2
# trap 'exec 2>&4 1>&3' 0 1 2 3
# exec 1>>~/tmp/gitfetch.log 2>&1
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"
if [ $diff -gt ${GIT_FETCH_INTERVAL:-30} ]; then
setopt localoptions noshwordsplit
setopt localoptions noshwordsplit
# Sets `GIT_TERMINAL_PROMPT=0` to disable authentication prompt for Git fetch (Git 2.3+).
export GIT_TERMINAL_PROMPT=0
@ -55,7 +60,7 @@ if [ $diff -gt ${GIT_FETCH_INTERVAL:-30} ]; then
command git -c gc.auto=0 fetch \
--quiet \
--no-tags \
--recurse-submodules=no \
--recurse-submodules=yes \
$remote &>/dev/null &
wait $! || return $fail_code