Merge commit 'f3ae4032c1923404afc9fd8b6af2bf28bc406d61'

pull/778/head
romkatv 5 years ago
commit 1e2a0cc34a

@ -35,6 +35,14 @@ git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/gitstatus
echo 'source ~/gitstatus/gitstatus.prompt.zsh' >>! ~/.zshrc echo 'source ~/gitstatus/gitstatus.prompt.zsh' >>! ~/.zshrc
``` ```
Users in mainland China can use the official mirror on gitee.com for faster download.<br>
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
```zsh
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git ~/gitstatus
echo 'source ~/gitstatus/gitstatus.prompt.zsh' >>! ~/.zshrc
```
Alternatively, on macOS you can install with Homebrew: Alternatively, on macOS you can install with Homebrew:
```zsh ```zsh
@ -128,6 +136,14 @@ git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/gitstatus
echo 'source ~/gitstatus/gitstatus.prompt.sh' >> ~/.bashrc echo 'source ~/gitstatus/gitstatus.prompt.sh' >> ~/.bashrc
``` ```
Users in mainland China can use the official mirror on gitee.com for faster download.<br>
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
```bash
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git ~/gitstatus
echo 'source ~/gitstatus/gitstatus.prompt.sh' >> ~/.bashrc
```
Alternatively, on macOS you can install with Homebrew: Alternatively, on macOS you can install with Homebrew:
```zsh ```zsh
@ -475,6 +491,15 @@ cd gitstatus
./build -w -s -d docker ./build -w -s -d docker
``` ```
Users in mainland China can use the official mirror on gitee.com for faster download.<br>
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
```zsh
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git
cd gitstatus
./build -w -s -d docker
```
- If it says that `-d docker` is not supported on your OS, remove this flag. - If it says that `-d docker` is not supported on your OS, remove this flag.
- If it says that `-s` is not supported on your OS, remove this flag. - If it says that `-s` is not supported on your OS, remove this flag.
- If it tell you to install docker but you cannot or don't want to, remove `-d docker`. - If it tell you to install docker but you cannot or don't want to, remove `-d docker`.

@ -525,6 +525,8 @@ function gitstatus_start"${1:-}"() {
local -i lock_fd resp_fd stderr_fd local -i lock_fd resp_fd stderr_fd
local file_prefix xtrace=/dev/null daemon_log=/dev/null local file_prefix xtrace=/dev/null daemon_log=/dev/null
{
if (( _GITSTATUS_STATE_$name )); then if (( _GITSTATUS_STATE_$name )); then
(( async )) && return (( async )) && return
(( _GITSTATUS_STATE_$name == 2 )) && return (( _GITSTATUS_STATE_$name == 2 )) && return
@ -617,35 +619,6 @@ function gitstatus_start"${1:-}"() {
[[ $req_fd == <1-> ]] || return [[ $req_fd == <1-> ]] || return
typeset -gi _GITSTATUS_REQ_FD_$name=req_fd typeset -gi _GITSTATUS_REQ_FD_$name=req_fd
function _gitstatus_process_response_$name-$fsuf() {
emulate -L zsh -o no_aliases -o extended_glob -o typeset_silent
local pair=${${(%):-%N}#_gitstatus_process_response_}
local name=${pair%%-*}
local fsuf=${pair#*-}
if (( ARGC == 1 )); then
_gitstatus_process_response$fsuf $name 0 ''
else
gitstatus_stop$fsuf $name
fi
}
if ! zle -F $resp_fd _gitstatus_process_response_$name-$fsuf; then
unfunction _gitstatus_process_response_$name-$fsuf
return 1
fi
function _gitstatus_cleanup_$name-$fsuf() {
emulate -L zsh -o no_aliases -o extended_glob -o typeset_silent
local pair=${${(%):-%N}#_gitstatus_cleanup_}
local name=${pair%%-*}
local fsuf=${pair#*-}
(( _GITSTATUS_CLIENT_PID_$name == sysparams[pid] )) || return
gitstatus_stop$fsuf $name
}
if ! add-zsh-hook zshexit _gitstatus_cleanup_$name-$fsuf; then
unfunction _gitstatus_cleanup_$name-$fsuf
return 1
fi
print -nru $req_fd -- $'hello\x1f\x1e' || return print -nru $req_fd -- $'hello\x1f\x1e' || return
local expected=$'hello\x1f0\x1e' actual local expected=$'hello\x1f0\x1e' actual
if (( $+functions[p10k] )) && [[ ! -t 1 && ! -t 0 ]]; then if (( $+functions[p10k] )) && [[ ! -t 1 && ! -t 0 ]]; then
@ -705,6 +678,36 @@ function gitstatus_start"${1:-}"() {
done done
[[ $actual == $expected ]] || return [[ $actual == $expected ]] || return
function _gitstatus_process_response_$name-$fsuf() {
emulate -L zsh -o no_aliases -o extended_glob -o typeset_silent
local pair=${${(%):-%N}#_gitstatus_process_response_}
local name=${pair%%-*}
local fsuf=${pair#*-}
[[ $name == POWERLEVEL9K && $fsuf == _p9k_ ]] && eval $__p9k_intro_base
if (( ARGC == 1 )); then
_gitstatus_process_response$fsuf $name 0 ''
else
gitstatus_stop$fsuf $name
fi
}
if ! zle -F $resp_fd _gitstatus_process_response_$name-$fsuf; then
unfunction _gitstatus_process_response_$name-$fsuf
return 1
fi
function _gitstatus_cleanup_$name-$fsuf() {
emulate -L zsh -o no_aliases -o extended_glob -o typeset_silent
local pair=${${(%):-%N}#_gitstatus_cleanup_}
local name=${pair%%-*}
local fsuf=${pair#*-}
(( _GITSTATUS_CLIENT_PID_$name == sysparams[pid] )) || return
gitstatus_stop$fsuf $name
}
if ! add-zsh-hook zshexit _gitstatus_cleanup_$name-$fsuf; then
unfunction _gitstatus_cleanup_$name-$fsuf
return 1
fi
if (( lock_fd != -1 )); then if (( lock_fd != -1 )); then
zf_rm -- $file_prefix.lock || return zf_rm -- $file_prefix.lock || return
zsystem flock -u $lock_fd || return zsystem flock -u $lock_fd || return
@ -714,7 +717,7 @@ function gitstatus_start"${1:-}"() {
typeset -gi _GITSTATUS_STATE_$name=2 typeset -gi _GITSTATUS_STATE_$name=2
fi fi
} }
} always {
local -i err=$? local -i err=$?
(( stderr_fd )) && exec 2>&$stderr_fd {stderr_fd}>&- (( stderr_fd )) && exec 2>&$stderr_fd {stderr_fd}>&-
(( err == 0 )) && return (( err == 0 )) && return
@ -722,6 +725,7 @@ function gitstatus_start"${1:-}"() {
gitstatus_stop$fsuf $name gitstatus_stop$fsuf $name
setopt prompt_percent no_prompt_subst no_prompt_bang setopt prompt_percent no_prompt_subst no_prompt_bang
print -ru2 -- ''
print -Pru2 -- '[%F{red}ERROR%f]: gitstatus failed to initialize.' print -Pru2 -- '[%F{red}ERROR%f]: gitstatus failed to initialize.'
print -ru2 -- '' print -ru2 -- ''
print -ru2 -- ' Your Git prompt may disappear or become slow.' print -ru2 -- ' Your Git prompt may disappear or become slow.'
@ -776,8 +780,7 @@ function gitstatus_start"${1:-}"() {
print -ru2 -- '' print -ru2 -- ''
print -ru2 -- ' With this parameter gitstatus will print additional information on error.' print -ru2 -- ' With this parameter gitstatus will print additional information on error.'
fi fi
}
return err
} }
# Stops gitstatusd if it's running. # Stops gitstatusd if it's running.

Loading…
Cancel
Save