1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-25 00:21:58 +00:00

pull upstream changes from gitstatus

This commit is contained in:
romkatv 2019-11-02 10:55:03 +01:00
parent 99e632f97d
commit a7db19ec7e
3 changed files with 22 additions and 7 deletions

View file

@ -273,10 +273,19 @@ function _gitstatus_process_response() {
# -d INT Report at most this many untracked files; negative value means infinity. # -d INT Report at most this many untracked files; negative value means infinity.
# Defaults to 1. # Defaults to 1.
# #
# -m INT If a repo has more files in its index than this, override -u and -d (but not -s) # -m INT Report -1 unstaged, untracked and conflicted if there are more than this many
# with zeros. Negative value means infinity. Defaults to -1. # files in the index. Negative value means infinity. Defaults to -1.
# #
# -e Count files within untracked directories like `git status --untracked-files`. # -e Count files within untracked directories like `git status --untracked-files`.
#
# -U Unless this option is specified, report zero untracked files for repositories
# with status.showUntrackedFiles = false.
#
# -W Unless this option is specified, report zero untracked files for repositories
# with bash.showUntrackedFiles = false.
#
# -D Unless this option is specified, report zero staged, unstaged and conflicted
# changes for repositories with bash.showDirtyState = false.
function gitstatus_start() { function gitstatus_start() {
emulate -L zsh emulate -L zsh
setopt err_return no_unset no_bg_nice setopt err_return no_unset no_bg_nice
@ -289,9 +298,9 @@ function gitstatus_start() {
local -i max_num_untracked=1 local -i max_num_untracked=1
local -i dirty_max_index_size=-1 local -i dirty_max_index_size=-1
local -i async local -i async
local recurse_untracked_dirs local -a extra_flags=()
while true; do while true; do
getopts "t:s:u:c:d:m:ea" opt || break getopts "t:s:u:c:d:m:eaUWD" opt || break
case $opt in case $opt in
a) async=1;; a) async=1;;
t) timeout=$OPTARG;; t) timeout=$OPTARG;;
@ -300,8 +309,14 @@ function gitstatus_start() {
c) max_num_conflicted=$OPTARG;; c) max_num_conflicted=$OPTARG;;
d) max_num_untracked=$OPTARG;; d) max_num_untracked=$OPTARG;;
m) dirty_max_index_size=$OPTARG;; m) dirty_max_index_size=$OPTARG;;
e) recurse_untracked_dirs='--recurse-untracked-dirs';; e) extra_flags+='--recurse-untracked-dirs';;
+e) recurse_untracked_dirs=;; +e) extra_flags=(${(@)extra_flags:#--recurse-untracked-dirs});;
U) extra_flags+='--ignore-status-show-untracked-files';;
+U) extra_flags=(${(@)extra_flags:#--ignore-status-show-untracked-files});;
W) extra_flags+='--ignore-bash-show-untracked-files';;
+W) extra_flags=(${(@)extra_flags:#--ignore-bash-show-untracked-files});;
D) extra_flags+='--ignore-bash-show-dirty-state';;
+D) extra_flags=(${(@)extra_flags:#--ignore-bash-show-dirty-state});;
?) return 1;; ?) return 1;;
esac esac
done done
@ -380,7 +395,7 @@ function gitstatus_start() {
--max-num-untracked=${(q)max_num_untracked} --max-num-untracked=${(q)max_num_untracked}
--dirty-max-index-size=${(q)dirty_max_index_size} --dirty-max-index-size=${(q)dirty_max_index_size}
--log-level=${(q)log_level:-INFO} --log-level=${(q)log_level:-INFO}
$recurse_untracked_dirs) $extra_flags)
local cmd=" local cmd="
exec >&4 exec >&4