Squashed 'gitstatus/' changes from 0127fd26a..cc956ca78

cc956ca78 interrupt p10k instant prompt before printing "gitstatus failed to initialize" error
db3603bc8 improve "gitstatus failed to initialize" error message
e164594ea work around bugs in cygwin
55af96ade cleanup + todo
0e70dbc56 add an empty line before the error message

git-subtree-dir: gitstatus
git-subtree-split: cc956ca7878ef6d00bb1f35861864d0a40ffac75
pull/778/head
romkatv 5 years ago
parent ee44f9e112
commit 9a4bbcd930

@ -56,9 +56,12 @@ appname=gitstatusd-"$gitstatus_kernel"-"$gitstatus_arch"
libgit2_tmp="$outdir"/deps/"$appname".libgit2.tmp
cleanup() {
trap - INT QUIT TERM ILL PIPE
cd /
if ! command rm -rf -- "$workdir" "$outdir"/usrbin/"$appname".tmp "$libgit2_tmp"; then
command sleep 5
command rm -rf -- "$workdir" "$outdir"/usrbin/"$appname".tmp "$libgit2_tmp"
trap - INT QUIT TERM ILL PIPE
fi
}
trap cleanup INT QUIT TERM ILL PIPE

@ -225,6 +225,7 @@ function gitstatus_start() {
}
if ! gitstatus_start_impl; then
echo "" >&2
echo "gitstatus_start: failed to start gitstatusd" >&2
[[ -z "${req_fifo:-}" ]] || command rm -f "$req_fifo"
[[ -z "${resp_fifo:-}" ]] || command rm -f "$resp_fifo"

@ -725,60 +725,46 @@ function gitstatus_start"${1:-}"() {
gitstatus_stop$fsuf $name
setopt prompt_percent no_prompt_subst no_prompt_bang
(( $+functions[p10k] )) && p10k clear-instant-prompt
print -ru2 -- ''
print -Pru2 -- '[%F{red}ERROR%f]: gitstatus failed to initialize.'
print -ru2 -- ''
print -ru2 -- ' Your Git prompt may disappear or become slow.'
if [[ -s $xtrace ]]; then
print -ru2 -- ''
print -ru2 -- " The content of ${(q-)xtrace} (gitstatus_start xtrace):"
print -Pru2 -- " Zsh log (%U${xtrace//\%/%%}%u):"
print -Pru2 -- '%F{yellow}'
>&2 awk '{print " " $0}' <$xtrace
print -Pru2 -- "%F{red} ^ this command failed ($err)%f"
print -lru2 -- "${(@)${(@f)$(<$xtrace)}/#/ }"
print -Pru2 -- " %F{red}^ this command failed ($err)%f"
fi
if [[ -s $daemon_log ]]; then
print -ru2 -- ''
print -ru2 -- " The content of ${(q-)daemon_log} (gitstatus daemon log):"
print -Pru2 -- " Daemon log (%U${daemon_log//\%/%%}%u):"
print -Pru2 -- '%F{yellow}'
>&2 awk '{print " " $0}' <$daemon_log
print -lru2 -- "${(@)${(@f)$(<$daemon_log)}/#/ }"
print -Pnru2 -- '%f'
fi
if [[ $GITSTATUS_LOG_LEVEL == DEBUG ]]; then
print -ru2 -- ''
print -ru2 -- ' Your system information:'
print -ru2 -- ' System information:'
print -Pru2 -- '%F{yellow}'
print -ru2 -- " zsh: $ZSH_VERSION"
print -ru2 -- " uname -a: $(uname -a)"
print -Pru2 -- '%f'
print -ru2 -- ' If you need help, open an issue and attach this whole error message to it:'
print -ru2 -- ''
print -Pru2 -- ' %F{green}https://github.com/romkatv/gitstatus/issues/new%f'
print -Pru2 -- ' %Uhttps://github.com/romkatv/gitstatus/issues/new%u'
else
print -ru2 -- ''
print -ru2 -- ' Run the following command to retry with extra diagnostics:'
print -Pru2 -- '%F{green}'
local env="GITSTATUS_LOG_LEVEL=DEBUG"
if [[ -n $GITSTATUS_NUM_THREADS ]]; then
env+=" GITSTATUS_NUM_THREADS=${(q)GITSTATUS_NUM_THREADS}"
fi
if [[ -n $GITSTATUS_DAEMON ]]; then
env+=" GITSTATUS_DAEMON=${(q)GITSTATUS_DAEMON}"
fi
if [[ -n $GITSTATUS_AUTO_INSTALL ]]; then
env+=" GITSTATUS_AUTO_INSTALL=${(q)GITSTATUS_AUTO_INSTALL}"
fi
if [[ -n $GITSTATUS_CACHE_DIR ]]; then
env+=" GITSTATUS_CACHE_DIR=${(q)GITSTATUS_CACHE_DIR}"
fi
print -nru2 -- " ${env} gitstatus_start ${(@q-)*}"
print -Pru2 -- '%f'
local home=~
local zshrc=${${${(q)${ZDOTDIR:-~}}/#${(q)home}/'~'}//\%/%%}/.zshrc
print -Pru2 -- " Add the following parameter to %U$zshrc%u for extra diagnostics on error:"
print -ru2 -- ''
local zshrc=${(D)ZDOTDIR:-~}/.zshrc
print -ru2 -- " If this command produces no output, add the following parameter to $zshrc:"
print -Pru2 -- ' %BGITSTATUS_LOG_LEVEL=DEBUG%b'
print -ru2 -- ''
print -Pru2 -- '%F{green} GITSTATUS_LOG_LEVEL=DEBUG%f'
print -ru2 -- ' Restart Zsh to retry gitstatus initialization:'
print -ru2 -- ''
print -ru2 -- ' With this parameter gitstatus will print additional information on error.'
print -Pru2 -- ' %F{green}%Uexec%u zsh%f'
fi
}
}

@ -151,7 +151,7 @@ done
shift $((OPTIND - 1))
(( $# )) || set -- ${(k)assets}
(( $# )) || set -- ${(ko)assets}
set -- ${(u)@}
local platform
@ -200,15 +200,22 @@ function build-windows() {
local tmp env bin intro flags=(-w)
case $2 in
msys_nt-10.0-i686) bin='msys32/usr/bin';|
msys_nt-10.0-x86_64) bin='msys64/usr/bin';|
cygwin_nt-10.0-i686) bin='cygwin32/bin' ;|
cygwin_nt-10.0-x86_64) bin='cygwin64/bin' ;|
msys_nt-10.0-i686) bin='msys32/usr/bin';|
msys_nt-10.0-x86_64) bin='msys64/usr/bin';|
cygwin_nt-10.0-*)
tmp='/cygdrive/c/tmp'
;|
msys_nt-10.0-*)
flags+=(-s)
tmp='/c/tmp'
env='MSYSTEM=MSYS'
intro='pacman -Syu --noconfirm; pacman -S --needed --noconfirm git; '
intro+='PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"'
while true; do
# TODO: run autorebase only when getting an error that can be fixed by autorebasing.
break
local out
out="$(ssh $1 cmd.exe "$c/${bin%%/*}/autorebase.bat" 2>&1)"
[[ $out == *"The following DLLs couldn't be rebased"* ]] || break
@ -243,12 +250,7 @@ function build-windows() {
}
done
} "$@"
intro='pacman -Syu --noconfirm; pacman -S --needed --noconfirm git; '
intro+='PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"'
;;
cygwin_nt-10.0-*)
tmp='/cygdrive/c/tmp'
;;
;|
esac
ssh $1 $c/$bin/env.exe $env c:/$bin/bash.exe -l <<<"

Loading…
Cancel
Save