|
|
|
@ -151,6 +151,9 @@ function git-info {
@@ -151,6 +151,9 @@ function git-info {
|
|
|
|
|
local dirty_format |
|
|
|
|
local dirty_formatted |
|
|
|
|
local ignore_submodules |
|
|
|
|
local indexed=0 |
|
|
|
|
local indexed_format |
|
|
|
|
local indexed_formatted |
|
|
|
|
local -A info_formats |
|
|
|
|
local info_format |
|
|
|
|
local line_number=0 |
|
|
|
@ -171,6 +174,10 @@ function git-info {
@@ -171,6 +174,10 @@ function git-info {
|
|
|
|
|
local stashed_format |
|
|
|
|
local stashed_formatted |
|
|
|
|
local status_cmd |
|
|
|
|
local status_mode |
|
|
|
|
local unindexed=0 |
|
|
|
|
local unindexed_format |
|
|
|
|
local unindexed_formatted |
|
|
|
|
local unmerged=0 |
|
|
|
|
local unmerged_format |
|
|
|
|
local unmerged_formatted |
|
|
|
@ -291,6 +298,65 @@ function git-info {
@@ -291,6 +298,65 @@ function git-info {
|
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Get status type. |
|
|
|
|
if ! zstyle -t ':prezto:module:git:info' verbose; then |
|
|
|
|
# Format indexed. |
|
|
|
|
zstyle -s ':prezto:module:git:info:indexed' format 'indexed_format' |
|
|
|
|
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 unindexed. |
|
|
|
|
zstyle -s ':prezto:module:git:info:unindexed' format 'unindexed_format' |
|
|
|
|
if [[ -n "$unindexed_format" ]]; then |
|
|
|
|
(( |
|
|
|
|
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 untracked. |
|
|
|
|
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format' |
|
|
|
|
if [[ -n "$untracked_format" ]]; then |
|
|
|
|
(( |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
(( dirty = indexed + unindexed + untracked )) |
|
|
|
|
else |
|
|
|
|
# Use porcelain status for easy parsing. |
|
|
|
|
status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}" |
|
|
|
|
|
|
|
|
@ -343,6 +409,7 @@ function git-info {
@@ -343,6 +409,7 @@ function git-info {
|
|
|
|
|
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format' |
|
|
|
|
zformat -f untracked_formatted "$untracked_format" "u:$untracked" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Format dirty and clean. |
|
|
|
|
if (( dirty > 0 )); then |
|
|
|
@ -364,6 +431,8 @@ function git-info {
@@ -364,6 +431,8 @@ function git-info {
|
|
|
|
|
"c:$commit_formatted" \ |
|
|
|
|
"d:$deleted_formatted" \ |
|
|
|
|
"D:$dirty_formatted" \ |
|
|
|
|
"i:$indexed_formatted" \ |
|
|
|
|
"I:$unindexed_formatted" \ |
|
|
|
|
"m:$modified_formatted" \ |
|
|
|
|
"p:$position_formatted" \ |
|
|
|
|
"R:$remote_formatted" \ |
|
|
|
|