mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 13:41:56 +00:00
Fix truncation of changeset in detached tag mode
This commit is contained in:
parent
a09eda6774
commit
7b2e995299
2 changed files with 9 additions and 8 deletions
|
@ -74,7 +74,7 @@ function +vi-git-tagname() {
|
||||||
# exists, so we have to manually retrieve it and clobber the branch
|
# exists, so we have to manually retrieve it and clobber the branch
|
||||||
# string.
|
# string.
|
||||||
local revision
|
local revision
|
||||||
revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD)
|
revision=$(git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)
|
||||||
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
|
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
|
||||||
else
|
else
|
||||||
# We are on both a tag and a branch; print both by appending the tag name.
|
# We are on both a tag and a branch; print both by appending the tag name.
|
||||||
|
|
|
@ -815,7 +815,14 @@ prompt_todo() {
|
||||||
# VCS segment: shows the state of your repository, if you are in a folder under
|
# VCS segment: shows the state of your repository, if you are in a folder under
|
||||||
# version control
|
# version control
|
||||||
set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red"
|
set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red"
|
||||||
|
# Default: Just display the first 8 characters of our changeset-ID.
|
||||||
|
set_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH "8"
|
||||||
prompt_vcs() {
|
prompt_vcs() {
|
||||||
|
if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then
|
||||||
|
POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load VCS_INFO
|
||||||
autoload -Uz vcs_info
|
autoload -Uz vcs_info
|
||||||
|
|
||||||
VCS_WORKDIR_DIRTY=false
|
VCS_WORKDIR_DIRTY=false
|
||||||
|
@ -832,13 +839,7 @@ prompt_vcs() {
|
||||||
|
|
||||||
VCS_CHANGESET_PREFIX=''
|
VCS_CHANGESET_PREFIX=''
|
||||||
if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then
|
if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then
|
||||||
# Default: Just display the first 8 characters of our changeset-ID.
|
VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i "
|
||||||
local VCS_CHANGESET_HASH_LENGTH=8
|
|
||||||
if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then
|
|
||||||
VCS_CHANGESET_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$VCS_CHANGESET_HASH_LENGTH""i "
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zstyle ':vcs_info:*' enable git hg
|
zstyle ':vcs_info:*' enable git hg
|
||||||
|
|
Loading…
Reference in a new issue