|
|
@ -143,6 +143,7 @@ function git-info {
|
|
|
|
local modified_format
|
|
|
|
local modified_format
|
|
|
|
local modified_formatted
|
|
|
|
local modified_formatted
|
|
|
|
local position
|
|
|
|
local position
|
|
|
|
|
|
|
|
local position_cmd
|
|
|
|
local position_format
|
|
|
|
local position_format
|
|
|
|
local position_formatted
|
|
|
|
local position_formatted
|
|
|
|
local prompt_format
|
|
|
|
local prompt_format
|
|
|
@ -204,6 +205,20 @@ function git-info {
|
|
|
|
# Gets the commit difference counts between local and remote.
|
|
|
|
# Gets the commit difference counts between local and remote.
|
|
|
|
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
|
|
|
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use describe to get the current position
|
|
|
|
|
|
|
|
zstyle -s 'omz:plugin:git:prompt:position' style 'position_style'
|
|
|
|
|
|
|
|
case "$position_style" in
|
|
|
|
|
|
|
|
(contains)
|
|
|
|
|
|
|
|
position_cmd='git describe --contains --tags HEAD'
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
(references)
|
|
|
|
|
|
|
|
position_cmd='git describe --contains --all HEAD'
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
(tags)
|
|
|
|
|
|
|
|
position_cmd='git describe --tags HEAD'
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
# Ignore submodule status.
|
|
|
|
# Ignore submodule status.
|
|
|
|
zstyle -b \
|
|
|
|
zstyle -b \
|
|
|
|
':omz:plugin:git:prompt:ignore' submodule 'ignore_submodule'
|
|
|
|
':omz:plugin:git:prompt:ignore' submodule 'ignore_submodule'
|
|
|
@ -279,7 +294,7 @@ function git-info {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# Format position.
|
|
|
|
# Format position.
|
|
|
|
position="$(git describe --contains --all HEAD 2> /dev/null)"
|
|
|
|
position="$(${(z)position_cmd} 2> /dev/null)"
|
|
|
|
if [[ -n "$position" ]]; then
|
|
|
|
if [[ -n "$position" ]]; then
|
|
|
|
zstyle -s ':omz:plugin:git:prompt' position 'position_format'
|
|
|
|
zstyle -s ':omz:plugin:git:prompt' position 'position_format'
|
|
|
|
zformat -f position_formatted "$position_format" "p:$position"
|
|
|
|
zformat -f position_formatted "$position_format" "p:$position"
|
|
|
|