|
|
@ -89,31 +89,6 @@ function _git-action {
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Turns off git-info for the current repository.
|
|
|
|
|
|
|
|
function _git-info-abort {
|
|
|
|
|
|
|
|
if ! is-true "$_git_info_executing"; then
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cat >&2 <<EOF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gathering status for certain repositories is time intensive.
|
|
|
|
|
|
|
|
By pressing CTRL + C, you have turned off prompt Git status
|
|
|
|
|
|
|
|
for this repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To revert, execute:
|
|
|
|
|
|
|
|
git-info on
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unset _git_info_executing
|
|
|
|
|
|
|
|
git config --bool prompt.showinfo false
|
|
|
|
|
|
|
|
git-info
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
add-zsh-trap INT _git-info-abort
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Gets the Git status information.
|
|
|
|
# Gets the Git status information.
|
|
|
|
function git-info {
|
|
|
|
function git-info {
|
|
|
|
# Extended globbing is needed to parse repository status.
|
|
|
|
# Extended globbing is needed to parse repository status.
|
|
|
@ -126,13 +101,13 @@ function git-info {
|
|
|
|
local added=0
|
|
|
|
local added=0
|
|
|
|
local added_format
|
|
|
|
local added_format
|
|
|
|
local added_formatted
|
|
|
|
local added_formatted
|
|
|
|
local ahead
|
|
|
|
local ahead=0
|
|
|
|
local ahead_and_behind
|
|
|
|
local ahead_and_behind
|
|
|
|
local ahead_and_behind_cmd
|
|
|
|
local ahead_and_behind_cmd
|
|
|
|
local ahead_format
|
|
|
|
local ahead_format
|
|
|
|
local ahead_formatted
|
|
|
|
local ahead_formatted
|
|
|
|
local ahead_or_behind
|
|
|
|
local ahead_or_behind
|
|
|
|
local behind
|
|
|
|
local behind=0
|
|
|
|
local behind_format
|
|
|
|
local behind_format
|
|
|
|
local behind_formatted
|
|
|
|
local behind_formatted
|
|
|
|
local branch
|
|
|
|
local branch
|
|
|
@ -151,9 +126,11 @@ function git-info {
|
|
|
|
local dirty_format
|
|
|
|
local dirty_format
|
|
|
|
local dirty_formatted
|
|
|
|
local dirty_formatted
|
|
|
|
local ignore_submodules
|
|
|
|
local ignore_submodules
|
|
|
|
|
|
|
|
local indexed=0
|
|
|
|
|
|
|
|
local indexed_format
|
|
|
|
|
|
|
|
local indexed_formatted
|
|
|
|
local -A info_formats
|
|
|
|
local -A info_formats
|
|
|
|
local info_format
|
|
|
|
local info_format
|
|
|
|
local line_number=0
|
|
|
|
|
|
|
|
local modified=0
|
|
|
|
local modified=0
|
|
|
|
local modified_format
|
|
|
|
local modified_format
|
|
|
|
local modified_formatted
|
|
|
|
local modified_formatted
|
|
|
@ -171,6 +148,10 @@ function git-info {
|
|
|
|
local stashed_format
|
|
|
|
local stashed_format
|
|
|
|
local stashed_formatted
|
|
|
|
local stashed_formatted
|
|
|
|
local status_cmd
|
|
|
|
local status_cmd
|
|
|
|
|
|
|
|
local status_mode
|
|
|
|
|
|
|
|
local unindexed=0
|
|
|
|
|
|
|
|
local unindexed_format
|
|
|
|
|
|
|
|
local unindexed_formatted
|
|
|
|
local unmerged=0
|
|
|
|
local unmerged=0
|
|
|
|
local unmerged_format
|
|
|
|
local unmerged_format
|
|
|
|
local unmerged_formatted
|
|
|
|
local unmerged_formatted
|
|
|
@ -203,135 +184,206 @@ function git-info {
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Used to abort and turn git-info off on SIGINT.
|
|
|
|
|
|
|
|
_git_info_executing=true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use porcelain status for easy parsing.
|
|
|
|
|
|
|
|
status_cmd='git status --porcelain'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Gets the remote name.
|
|
|
|
|
|
|
|
remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Gets the commit difference counts between local and remote.
|
|
|
|
|
|
|
|
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ignore submodule status.
|
|
|
|
# Ignore submodule status.
|
|
|
|
zstyle -s ':prezto:module:git:status:ignore' submodules 'ignore_submodules'
|
|
|
|
zstyle -s ':prezto:module:git:status:ignore' submodules 'ignore_submodules'
|
|
|
|
if [[ -n "$ignore_submodules" ]]; then
|
|
|
|
|
|
|
|
status_cmd+=" --ignore-submodules=${ignore_submodules}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format commit.
|
|
|
|
# Format commit.
|
|
|
|
commit="$(git rev-parse HEAD 2> /dev/null)"
|
|
|
|
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
|
|
|
|
if [[ -n "$commit" ]]; then
|
|
|
|
if [[ -n "$commit_format" ]]; then
|
|
|
|
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
|
|
|
|
commit="$(git rev-parse HEAD 2> /dev/null)"
|
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit"
|
|
|
|
if [[ -n "$commit" ]]; then
|
|
|
|
|
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format stashed.
|
|
|
|
# Format stashed.
|
|
|
|
if [[ -f "$(git-dir)/refs/stash" ]]; then
|
|
|
|
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
|
|
|
|
|
|
|
|
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
|
|
|
|
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
|
|
|
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
|
|
|
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
|
|
|
|
if [[ -n "$stashed" ]]; then
|
|
|
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
|
|
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format action.
|
|
|
|
# Format action.
|
|
|
|
action="$(_git-action)"
|
|
|
|
zstyle -s ':prezto:module:git:info:action' format 'action_format'
|
|
|
|
if [[ -n "$action" ]]; then
|
|
|
|
if [[ -n "$action_format" ]]; then
|
|
|
|
zstyle -s ':prezto:module:git:info:action' format 'action_format'
|
|
|
|
action="$(_git-action)"
|
|
|
|
zformat -f action_formatted "$action_format" "s:$action"
|
|
|
|
if [[ -n "$action" ]]; then
|
|
|
|
|
|
|
|
zformat -f action_formatted "$action_format" "s:$action"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get current status.
|
|
|
|
# Get the branch.
|
|
|
|
while IFS=$'\n' read line; do
|
|
|
|
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
|
|
|
# Count added, deleted, modified, renamed, unmerged, untracked, dirty.
|
|
|
|
|
|
|
|
# T (type change) is undocumented, see http://git.io/FnpMGw.
|
|
|
|
|
|
|
|
# For a table of scenarii, see http://i.imgur.com/2YLu1.png.
|
|
|
|
|
|
|
|
[[ "$line" == ([ACDMT][\ MT]|[ACMT]D)\ * ]] && (( added++ ))
|
|
|
|
|
|
|
|
[[ "$line" == [\ ACMRT]D\ * ]] && (( deleted++ ))
|
|
|
|
|
|
|
|
[[ "$line" == ?[MT]\ * ]] && (( modified++ ))
|
|
|
|
|
|
|
|
[[ "$line" == R?\ * ]] && (( renamed++ ))
|
|
|
|
|
|
|
|
[[ "$line" == (AA|DD|U?|?U)\ * ]] && (( unmerged++ ))
|
|
|
|
|
|
|
|
[[ "$line" == \?\?\ * ]] && (( untracked++ ))
|
|
|
|
|
|
|
|
(( dirty++ ))
|
|
|
|
|
|
|
|
done < <(${(z)status_cmd} 2> /dev/null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format branch.
|
|
|
|
# Format branch.
|
|
|
|
branch="${$(git symbolic-ref -q HEAD)##refs/heads/}"
|
|
|
|
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
|
|
|
if [[ -n "$branch" ]]; then
|
|
|
|
if [[ -n "$branch" && -n "$branch_format" ]]; then
|
|
|
|
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
|
|
|
|
|
|
|
zformat -f branch_formatted "$branch_format" "b:$branch"
|
|
|
|
zformat -f branch_formatted "$branch_format" "b:$branch"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format position.
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
|
|
|
|
|
|
|
if [[ -z "$branch" && -n "$position_format" ]]; then
|
|
|
|
|
|
|
|
position="$(git describe --contains --all HEAD 2> /dev/null)"
|
|
|
|
|
|
|
|
if [[ -n "$position" ]]; then
|
|
|
|
|
|
|
|
zformat -f position_formatted "$position_format" "p:$position"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format remote.
|
|
|
|
# Format remote.
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
|
|
|
|
|
|
|
|
if [[ -n "$branch" && -n "$remote_format" ]]; then
|
|
|
|
|
|
|
|
# Gets the remote name.
|
|
|
|
|
|
|
|
remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
|
|
|
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
|
|
|
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
|
|
|
if [[ -n "$remote" ]]; then
|
|
|
|
if [[ -n "$remote" ]]; then
|
|
|
|
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
|
|
|
|
|
|
|
|
zformat -f remote_formatted "$remote_format" "R:$remote"
|
|
|
|
zformat -f remote_formatted "$remote_format" "R:$remote"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get ahead and behind counts.
|
|
|
|
zstyle -s ':prezto:module:git:info:ahead' format 'ahead_format'
|
|
|
|
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
|
|
|
|
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
|
|
|
|
|
|
|
|
if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
|
|
|
|
|
|
|
|
# Gets the commit difference counts between local and remote.
|
|
|
|
|
|
|
|
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
|
|
|
|
|
|
|
|
|
|
|
# Format ahead.
|
|
|
|
# Get ahead and behind counts.
|
|
|
|
|
|
|
|
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format ahead.
|
|
|
|
|
|
|
|
if [[ -n "$ahead_format" ]]; then
|
|
|
|
ahead="$ahead_and_behind[(w)1]"
|
|
|
|
ahead="$ahead_and_behind[(w)1]"
|
|
|
|
if (( $ahead > 0 )); then
|
|
|
|
if (( ahead > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:ahead' format 'ahead_format'
|
|
|
|
|
|
|
|
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
|
|
|
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format behind.
|
|
|
|
# Format behind.
|
|
|
|
|
|
|
|
if [[ -n "$behind_format" ]]; then
|
|
|
|
behind="$ahead_and_behind[(w)2]"
|
|
|
|
behind="$ahead_and_behind[(w)2]"
|
|
|
|
if (( $behind > 0 )); then
|
|
|
|
if (( behind > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
|
|
|
|
|
|
|
|
zformat -f behind_formatted "$behind_format" "B:$behind"
|
|
|
|
zformat -f behind_formatted "$behind_format" "B:$behind"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
|
|
|
|
# Format position.
|
|
|
|
|
|
|
|
position="$(git describe --contains --all HEAD 2> /dev/null)"
|
|
|
|
|
|
|
|
if [[ -n "$position" ]]; then
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
|
|
|
|
|
|
|
zformat -f position_formatted "$position_format" "p:$position"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format added.
|
|
|
|
# Get status type.
|
|
|
|
if (( $added > 0 )); then
|
|
|
|
if ! zstyle -t ':prezto:module:git:info' verbose; then
|
|
|
|
zstyle -s ':prezto:module:git:info:added' format 'added_format'
|
|
|
|
# Format indexed.
|
|
|
|
zformat -f added_formatted "$added_format" "a:$added_format"
|
|
|
|
zstyle -s ':prezto:module:git:info:indexed' format 'indexed_format'
|
|
|
|
fi
|
|
|
|
if [[ -n "$indexed_format" ]]; then
|
|
|
|
|
|
|
|
((
|
|
|
|
|
|
|
|
indexed+=$(
|
|
|
|
|
|
|
|
git diff-index \
|
|
|
|
|
|
|
|
--no-ext-diff \
|
|
|
|
|
|
|
|
--name-only \
|
|
|
|
|
|
|
|
--cached \
|
|
|
|
|
|
|
|
--ignore-submodules=${ignore_submodules:-none} \
|
|
|
|
|
|
|
|
HEAD \
|
|
|
|
|
|
|
|
2> /dev/null \
|
|
|
|
|
|
|
|
| wc -l
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
if (( indexed > 0 )); then
|
|
|
|
|
|
|
|
zformat -f indexed_formatted "$indexed_format" "i:$indexed"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format deleted.
|
|
|
|
# Format unindexed.
|
|
|
|
if (( $deleted > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:unindexed' format 'unindexed_format'
|
|
|
|
zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format'
|
|
|
|
if [[ -n "$unindexed_format" ]]; then
|
|
|
|
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
|
|
|
|
((
|
|
|
|
fi
|
|
|
|
unindexed+=$(
|
|
|
|
|
|
|
|
git diff-files \
|
|
|
|
|
|
|
|
--no-ext-diff \
|
|
|
|
|
|
|
|
--name-only \
|
|
|
|
|
|
|
|
--ignore-submodules=${ignore_submodules:-none} \
|
|
|
|
|
|
|
|
2> /dev/null \
|
|
|
|
|
|
|
|
| wc -l
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
if (( unindexed > 0 )); then
|
|
|
|
|
|
|
|
zformat -f unindexed_formatted "$unindexed_format" "I:$unindexed"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format modified.
|
|
|
|
# Format untracked.
|
|
|
|
if (( $modified > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format'
|
|
|
|
zstyle -s ':prezto:module:git:info:modified' format 'modified_format'
|
|
|
|
if [[ -n "$untracked_format" ]]; then
|
|
|
|
zformat -f modified_formatted "$modified_format" "m:$modified"
|
|
|
|
((
|
|
|
|
fi
|
|
|
|
untracked+=$(
|
|
|
|
|
|
|
|
git ls-files \
|
|
|
|
|
|
|
|
--other \
|
|
|
|
|
|
|
|
--exclude-standard \
|
|
|
|
|
|
|
|
2> /dev/null \
|
|
|
|
|
|
|
|
| wc -l
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
if (( untracked > 0 )); then
|
|
|
|
|
|
|
|
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format renamed.
|
|
|
|
(( dirty = indexed + unindexed + untracked ))
|
|
|
|
if (( $renamed > 0 )); then
|
|
|
|
else
|
|
|
|
zstyle -s ':prezto:module:git:info:renamed' format 'renamed_format'
|
|
|
|
# Use porcelain status for easy parsing.
|
|
|
|
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
|
|
|
|
status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get current status.
|
|
|
|
|
|
|
|
while IFS=$'\n' read line; do
|
|
|
|
|
|
|
|
# Count added, deleted, modified, renamed, unmerged, untracked, dirty.
|
|
|
|
|
|
|
|
# T (type change) is undocumented, see http://git.io/FnpMGw.
|
|
|
|
|
|
|
|
# For a table of scenarii, see http://i.imgur.com/2YLu1.png.
|
|
|
|
|
|
|
|
[[ "$line" == ([ACDMT][\ MT]|[ACMT]D)\ * ]] && (( added++ ))
|
|
|
|
|
|
|
|
[[ "$line" == [\ ACMRT]D\ * ]] && (( deleted++ ))
|
|
|
|
|
|
|
|
[[ "$line" == ?[MT]\ * ]] && (( modified++ ))
|
|
|
|
|
|
|
|
[[ "$line" == R?\ * ]] && (( renamed++ ))
|
|
|
|
|
|
|
|
[[ "$line" == (AA|DD|U?|?U)\ * ]] && (( unmerged++ ))
|
|
|
|
|
|
|
|
[[ "$line" == \?\?\ * ]] && (( untracked++ ))
|
|
|
|
|
|
|
|
(( dirty++ ))
|
|
|
|
|
|
|
|
done < <(${(z)status_cmd} 2> /dev/null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format added.
|
|
|
|
|
|
|
|
if (( added > 0 )); then
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:added' format 'added_format'
|
|
|
|
|
|
|
|
zformat -f added_formatted "$added_format" "a:$added_format"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format unmerged.
|
|
|
|
# Format deleted.
|
|
|
|
if (( $unmerged > 0 )); then
|
|
|
|
if (( deleted > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:unmerged' format 'unmerged_format'
|
|
|
|
zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format'
|
|
|
|
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
|
|
|
|
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format untracked.
|
|
|
|
# Format modified.
|
|
|
|
if (( $untracked > 0 )); then
|
|
|
|
if (( modified > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format'
|
|
|
|
zstyle -s ':prezto:module:git:info:modified' format 'modified_format'
|
|
|
|
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
|
|
|
|
zformat -f modified_formatted "$modified_format" "m:$modified"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format renamed.
|
|
|
|
|
|
|
|
if (( renamed > 0 )); then
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:renamed' format 'renamed_format'
|
|
|
|
|
|
|
|
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format unmerged.
|
|
|
|
|
|
|
|
if (( unmerged > 0 )); then
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:unmerged' format 'unmerged_format'
|
|
|
|
|
|
|
|
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format untracked.
|
|
|
|
|
|
|
|
if (( untracked > 0 )); then
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format'
|
|
|
|
|
|
|
|
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Format dirty and clean.
|
|
|
|
# Format dirty and clean.
|
|
|
|
if (( $dirty > 0 )); then
|
|
|
|
if (( dirty > 0 )); then
|
|
|
|
zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format'
|
|
|
|
zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format'
|
|
|
|
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
|
|
|
|
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -342,27 +394,28 @@ function git-info {
|
|
|
|
zstyle -a ':prezto:module:git:info:keys' format 'info_formats'
|
|
|
|
zstyle -a ':prezto:module:git:info:keys' format 'info_formats'
|
|
|
|
for info_format in ${(k)info_formats}; do
|
|
|
|
for info_format in ${(k)info_formats}; do
|
|
|
|
zformat -f REPLY "$info_formats[$info_format]" \
|
|
|
|
zformat -f REPLY "$info_formats[$info_format]" \
|
|
|
|
|
|
|
|
"a:$added_formatted" \
|
|
|
|
"A:$ahead_formatted" \
|
|
|
|
"A:$ahead_formatted" \
|
|
|
|
"B:$behind_formatted" \
|
|
|
|
"B:$behind_formatted" \
|
|
|
|
"D:$dirty_formatted" \
|
|
|
|
|
|
|
|
"R:$remote_formatted" \
|
|
|
|
|
|
|
|
"S:$stashed_formatted" \
|
|
|
|
|
|
|
|
"U:$unmerged_formatted" \
|
|
|
|
|
|
|
|
"a:$added_formatted" \
|
|
|
|
|
|
|
|
"b:$branch_formatted" \
|
|
|
|
"b:$branch_formatted" \
|
|
|
|
"C:$clean_formatted" \
|
|
|
|
"C:$clean_formatted" \
|
|
|
|
"c:$commit_formatted" \
|
|
|
|
"c:$commit_formatted" \
|
|
|
|
"d:$deleted_formatted" \
|
|
|
|
"d:$deleted_formatted" \
|
|
|
|
|
|
|
|
"D:$dirty_formatted" \
|
|
|
|
|
|
|
|
"i:$indexed_formatted" \
|
|
|
|
|
|
|
|
"I:$unindexed_formatted" \
|
|
|
|
"m:$modified_formatted" \
|
|
|
|
"m:$modified_formatted" \
|
|
|
|
"p:$position_formatted" \
|
|
|
|
"p:$position_formatted" \
|
|
|
|
|
|
|
|
"R:$remote_formatted" \
|
|
|
|
"r:$renamed_formatted" \
|
|
|
|
"r:$renamed_formatted" \
|
|
|
|
"s:$action_formatted" \
|
|
|
|
"s:$action_formatted" \
|
|
|
|
|
|
|
|
"S:$stashed_formatted" \
|
|
|
|
|
|
|
|
"U:$unmerged_formatted" \
|
|
|
|
"u:$untracked_formatted"
|
|
|
|
"u:$untracked_formatted"
|
|
|
|
git_info[$info_format]="$REPLY"
|
|
|
|
git_info[$info_format]="$REPLY"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
unset REPLY
|
|
|
|
unset REPLY
|
|
|
|
unset _git_info_executing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|