1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-26 00:41:57 +00:00

unbreak Git commit formatting

This commit is contained in:
romkatv 2019-12-09 14:15:57 +01:00
parent 90238d8df8
commit 14fc4d838c
3 changed files with 15 additions and 12 deletions

View file

@ -370,16 +370,13 @@
fi fi
local res local res
local where # branch name, tag or commit local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}" res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH} where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#" res+="${meta}#"
where=${(V)VCS_STATUS_TAG} where=${(V)VCS_STATUS_TAG}
else
res+="${meta}@"
where=${VCS_STATUS_COMMIT[1,8]}
fi fi
# If local branch name or tag is at most 32 characters long, show it in full. # If local branch name or tag is at most 32 characters long, show it in full.
@ -387,6 +384,10 @@
(( $#where > 32 )) && where[13,-13]="…" (( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape % res+="${clean}${where//\%/%%}" # escape %
# Display the current Git commit if there is no branch or tag.
# Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
[[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
# Show tracking branch name if it differs from local branch. # Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %

View file

@ -363,16 +363,13 @@
fi fi
local res local res
local where # branch name, tag or commit local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}" res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH} where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#" res+="${meta}#"
where=${(V)VCS_STATUS_TAG} where=${(V)VCS_STATUS_TAG}
else
res+="${meta}@"
where=${VCS_STATUS_COMMIT[1,8]}
fi fi
# If local branch name or tag is at most 32 characters long, show it in full. # If local branch name or tag is at most 32 characters long, show it in full.
@ -380,6 +377,10 @@
(( $#where > 32 )) && where[13,-13]="…" (( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape % res+="${clean}${where//\%/%%}" # escape %
# Display the current Git commit if there is no branch or tag.
# Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
[[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
# Show tracking branch name if it differs from local branch. # Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %

View file

@ -369,16 +369,13 @@
local conflicted='%1F' # red foreground local conflicted='%1F' # red foreground
local res local res
local where # branch name, tag or commit local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}" res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH} where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#" res+="${meta}#"
where=${(V)VCS_STATUS_TAG} where=${(V)VCS_STATUS_TAG}
else
res+="${meta}@"
where=${VCS_STATUS_COMMIT[1,8]}
fi fi
# If local branch name or tag is at most 32 characters long, show it in full. # If local branch name or tag is at most 32 characters long, show it in full.
@ -386,6 +383,10 @@
(( $#where > 32 )) && where[13,-13]="…" (( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape % res+="${clean}${where//\%/%%}" # escape %
# Display the current Git commit if there is no branch or tag.
# Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
[[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
# Show tracking branch name if it differs from local branch. # Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %