From b46a96a7cee43ed35c319e04800a5d043e371163 Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Tue, 22 Mar 2016 17:29:34 +0100 Subject: Git tag not replacing branch --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9d3883ca..847275fa 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -64,7 +64,7 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - [[ -n "${tag}" ]] && hook_com[branch]="$(print_icon 'VCS_TAG_ICON')${tag}" + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" } # Show count of stashed changes -- cgit v1.2.3 From 89fefbdf6edb353e557bde8fd484d8d2460518d8 Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Tue, 22 Mar 2016 17:51:01 +0100 Subject: DETACHED_HEAD handling --- functions/vcs.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 847275fa..92731d52 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,10 +61,12 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { + if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi } # Show count of stashed changes -- cgit v1.2.3 From 4fdf5df25884ecfaa6668dbc152ee5e7c573d8d2 Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Tue, 22 Mar 2016 18:24:34 +0100 Subject: Documentation --- functions/vcs.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 92731d52..af247d9c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,10 +61,13 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { + # Only show the tag name if we are not in DETACHED_HEAD state, + # since in that case it would already be displayed in the branch segment if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + # Append the tag segment to the branch one [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi } -- cgit v1.2.3 From 1ab41d9a6c9e2a4f62e3ebaac71cb2a87dde20cb Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Fri, 25 Mar 2016 10:51:33 +0100 Subject: Better DETACHED_HEAD detection --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index af247d9c..368251b6 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -63,7 +63,7 @@ function +vi-git-remotebranch() { function +vi-git-tagname() { # Only show the tag name if we are not in DETACHED_HEAD state, # since in that case it would already be displayed in the branch segment - if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then + if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) -- cgit v1.2.3 From ce16b087c6c0f51570903cf89d7e8b7f87287380 Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Mon, 11 Apr 2016 21:37:28 +0200 Subject: Avoid tag/branch duplication if same value --- functions/vcs.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 368251b6..f112e6a1 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,8 +67,12 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + head=$(git describe --all) + # Make sure that detached head and tag differ in name + if [[ "${head}" != "${tag}" ]]; then + # Append the tag segment to the branch one + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi fi } -- cgit v1.2.3 From 14e213bd681d9e6733f753cb068fb491a4e174f0 Mon Sep 17 00:00:00 2001 From: Niccolò Maggioni Date: Mon, 11 Apr 2016 23:02:58 +0200 Subject: Weird conditions handling Become a programmer, they said. It'll be fun, they said. --- functions/vcs.zsh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index f112e6a1..074d1e05 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -62,16 +62,20 @@ function +vi-git-remotebranch() { function +vi-git-tagname() { # Only show the tag name if we are not in DETACHED_HEAD state, - # since in that case it would already be displayed in the branch segment - if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" ]] ; then - local tag + # or if the current branch's HEAD is the same commit as a tag but + # doesn't have the same name + local tag + tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then head=$(git describe --all) - # Make sure that detached head and tag differ in name - if [[ "${head}" != "${tag}" ]]; then - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + # Make sure that detached head or checked out name differs from tag name + if [[ "${head}" != "${tag}" || + "$(git rev-parse --abbrev-ref HEAD)" != "${tag}" && + "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" && + "$(git rev-list -n 1 HEAD)" == "$(git rev-list -n 1 ${tag})" ]]; then + # Append the tag segment to the branch one + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi fi } -- cgit v1.2.3 From 6fde7bf3fdce11ab38e50bbcc48e96cb22166d42 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 09:30:28 -0400 Subject: git-tagname: reducing conditionals in logic --- functions/vcs.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 074d1e05..c2b8185a 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,7 +67,10 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then + # if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then + if [[ -n "${tag}" ]] ; then + # There is a tag that points to our current commit. Need to determine if we + # are also on a branch, or are in a DETACHED_HEAD state. head=$(git describe --all) # Make sure that detached head or checked out name differs from tag name if [[ "${head}" != "${tag}" || -- cgit v1.2.3 From 0f4e3e7588fff005a8ad275915f390817f804345 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 10:43:34 -0400 Subject: git-tagname: Now showing hash/branchname when sitting on a tag --- functions/vcs.zsh | 17 ++++++++--------- powerlevel9k.zsh-theme | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index c2b8185a..3a5a6cb5 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,18 +67,17 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - # if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then if [[ -n "${tag}" ]] ; then # There is a tag that points to our current commit. Need to determine if we # are also on a branch, or are in a DETACHED_HEAD state. - head=$(git describe --all) - # Make sure that detached head or checked out name differs from tag name - if [[ "${head}" != "${tag}" || - "$(git rev-parse --abbrev-ref HEAD)" != "${tag}" && - "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" && - "$(git rev-list -n 1 HEAD)" == "$(git rev-list -n 1 ${tag})" ]]; then - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then + # DETACHED_HEAD state. Print the commit hash and tag name. + local revision + revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD) + hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}" + else + # We are on both a tag and a branch; print both. + hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi fi } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 7da17f99..faae532c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -832,8 +832,8 @@ prompt_vcs() { VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - # Default: Just display the first 12 characters of our changeset-ID. - local VCS_CHANGESET_HASH_LENGTH=12 + # Default: Just display the first 8 characters of our changeset-ID. + local VCS_CHANGESET_HASH_LENGTH=8 if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then VCS_CHANGESET_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" fi -- cgit v1.2.3 From a09eda677421bea934a08a0d1bc5196ab973d853 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 10:54:10 -0400 Subject: Fixing comments in vi-git -tagname --- functions/vcs.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 3a5a6cb5..63cdbc75 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,9 +61,7 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { - # Only show the tag name if we are not in DETACHED_HEAD state, - # or if the current branch's HEAD is the same commit as a tag but - # doesn't have the same name + # If we are on a tag, append the tagname to the current branch string. local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) @@ -71,12 +69,15 @@ function +vi-git-tagname() { # There is a tag that points to our current commit. Need to determine if we # are also on a branch, or are in a DETACHED_HEAD state. if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then - # DETACHED_HEAD state. Print the commit hash and tag name. + # DETACHED_HEAD state. We want to append the tag name to the commit hash + # and print it. Unfortunately, `vcs_info` blows away the hash when a tag + # exists, so we have to manually retrieve it and clobber the branch + # string. local revision revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD) hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}" else - # We are on both a tag and a branch; print both. + # We are on both a tag and a branch; print both by appending the tag name. hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi fi -- cgit v1.2.3 From 7b2e995299175a8d2e573413975ff8da43b0a9a2 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 17 Apr 2016 17:51:31 +0200 Subject: Fix truncation of changeset in detached tag mode --- functions/vcs.zsh | 2 +- powerlevel9k.zsh-theme | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 63cdbc75..15f0177e 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -74,7 +74,7 @@ function +vi-git-tagname() { # exists, so we have to manually retrieve it and clobber the branch # string. 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}" else # We are on both a tag and a branch; print both by appending the tag name. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index faae532c..ed1c49cb 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -815,7 +815,14 @@ prompt_todo() { # VCS segment: shows the state of your repository, if you are in a folder under # version control 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() { + if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then + POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" + fi + + # Load VCS_INFO autoload -Uz vcs_info VCS_WORKDIR_DIRTY=false @@ -832,13 +839,7 @@ prompt_vcs() { VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - # Default: Just display the first 8 characters of our changeset-ID. - 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 " + VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " fi zstyle ':vcs_info:*' enable git hg -- cgit v1.2.3 From ef2d01a2aa4ce3c6edcef990f780b8babcae8d07 Mon Sep 17 00:00:00 2001 From: Chris Hudson Date: Thu, 7 Jul 2016 22:40:26 +0100 Subject: Added POWERLEVEL9K_VCS_HIDE_TAGS variable to control displaying of vcs tags in segment --- README.md | 4 +++- functions/vcs.zsh | 38 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/README.md b/README.md index bff47f24..63908782 100644 --- a/README.md +++ b/README.md @@ -348,8 +348,10 @@ customization is provided via: |`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.| |`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.| |`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.| +|`POWERLEVEL9K_VCS_HIDE_TAGS`|unset|Set to `true` to stop tags being displayed in the segment.| -**vcs Symbols** + +##### vcs symbols The `vcs` segment uses various symbols to tell you the state of your repository. These symbols depend on your installed font and selected `POWERLEVEL9K_MODE` diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 15f0177e..b2d87d30 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,24 +61,26 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { - # If we are on a tag, append the tagname to the current branch string. - local tag - tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - - if [[ -n "${tag}" ]] ; then - # There is a tag that points to our current commit. Need to determine if we - # are also on a branch, or are in a DETACHED_HEAD state. - if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then - # DETACHED_HEAD state. We want to append the tag name to the commit hash - # and print it. Unfortunately, `vcs_info` blows away the hash when a tag - # exists, so we have to manually retrieve it and clobber the branch - # string. - local revision - 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}" - else - # We are on both a tag and a branch; print both by appending the tag name. - hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + if [[ -z "${POWERLEVE9K_VCS_HIDE_TAGS}" ]]; then + # If we are on a tag, append the tagname to the current branch string. + local tag + tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + + if [[ -n "${tag}" ]] ; then + # There is a tag that points to our current commit. Need to determine if we + # are also on a branch, or are in a DETACHED_HEAD state. + if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then + # DETACHED_HEAD state. We want to append the tag name to the commit hash + # and print it. Unfortunately, `vcs_info` blows away the hash when a tag + # exists, so we have to manually retrieve it and clobber the branch + # string. + local revision + 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}" + else + # We are on both a tag and a branch; print both by appending the tag name. + hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi fi fi } -- cgit v1.2.3 From 3291b4d476fdd43a2a111f811f99f1ee088843e4 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Jul 2016 20:28:01 -0400 Subject: Merging ability to hide tags from VCS segment. --- README.md | 2 +- functions/vcs.zsh | 43 ++++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 22 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/README.md b/README.md index 63908782..164b484f 100644 --- a/README.md +++ b/README.md @@ -348,7 +348,7 @@ customization is provided via: |`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.| |`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.| |`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.| -|`POWERLEVEL9K_VCS_HIDE_TAGS`|unset|Set to `true` to stop tags being displayed in the segment.| +|`POWERLEVEL9K_VCS_HIDE_TAGS`|`false`|Set to `true` to stop tags being displayed in the segment.| ##### vcs symbols diff --git a/functions/vcs.zsh b/functions/vcs.zsh index b2d87d30..657a0f3f 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -60,29 +60,30 @@ function +vi-git-remotebranch() { fi } +set_default POWERLEVEL9K_VCS_HIDE_TAGS false function +vi-git-tagname() { - if [[ -z "${POWERLEVE9K_VCS_HIDE_TAGS}" ]]; then - # If we are on a tag, append the tagname to the current branch string. - local tag - tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - - if [[ -n "${tag}" ]] ; then - # There is a tag that points to our current commit. Need to determine if we - # are also on a branch, or are in a DETACHED_HEAD state. - if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then - # DETACHED_HEAD state. We want to append the tag name to the commit hash - # and print it. Unfortunately, `vcs_info` blows away the hash when a tag - # exists, so we have to manually retrieve it and clobber the branch - # string. - local revision - 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}" - else - # We are on both a tag and a branch; print both by appending the tag name. - hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" - fi + if [[ "$POWERLEVE9K_VCS_HIDE_TAGS" == "false" ]]; then + # If we are on a tag, append the tagname to the current branch string. + local tag + tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + + if [[ -n "${tag}" ]] ; then + # There is a tag that points to our current commit. Need to determine if we + # are also on a branch, or are in a DETACHED_HEAD state. + if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then + # DETACHED_HEAD state. We want to append the tag name to the commit hash + # and print it. Unfortunately, `vcs_info` blows away the hash when a tag + # exists, so we have to manually retrieve it and clobber the branch + # string. + local revision + 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}" + else + # We are on both a tag and a branch; print both by appending the tag name. + hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi + fi fi - fi } # Show count of stashed changes -- cgit v1.2.3 From 62e41ada1fe6db11cd08e6fee73532aa5af50254 Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:13:15 +0200 Subject: added vi-svn-detect-changes() in functions/vcs.zsh --- functions/vcs.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 657a0f3f..66c6a0d2 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -113,6 +113,8 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_ICON' elif [[ "${hook_com[vcs]}" == "hg" ]]; then vcs_visual_identifier='VCS_HG_ICON' +# elif [[ "${hook_com[vcs]}" == "svn" ]]; then +# vcs_visual_identifier='VCS_SVN_ICON' fi if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then @@ -121,3 +123,15 @@ function +vi-vcs-detect-changes() { VCS_WORKDIR_DIRTY=false fi } + +function +vi-svn-detect-changes() { + local svn_status=$(svn status) + if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then + VCS_WORKDIR_DIRTY=true + elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + VCS_WORKDIR_HALF_DIRTY=true + else + VCS_WORKDIR_DIRTY=false + VCS_WORKDIR_HALF_DIRTY=false + fi +} -- cgit v1.2.3 From e134c70bc16c3b58d02bcb58b11fc402d005562e Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:31:00 +0200 Subject: swapped half and full dirty in svn-detect-changes --- functions/vcs.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 66c6a0d2..6cea3e8c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -127,9 +127,9 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then - VCS_WORKDIR_DIRTY=true - elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then VCS_WORKDIR_HALF_DIRTY=true + elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + VCS_WORKDIR_DIRTY=true else VCS_WORKDIR_DIRTY=false VCS_WORKDIR_HALF_DIRTY=false -- cgit v1.2.3 From 3b0da2c3489fd65543d9b116d4aaa7d1405fff32 Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:51:16 +0200 Subject: fixed svn-detect-changes().. the svn prompt has now the same behaviour as the git prompt.. --- functions/vcs.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 6cea3e8c..50b58fbf 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -127,11 +127,11 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then + hook_com[unstaged]+=" $(print_icon 'VCS_STASH_ICON')" VCS_WORKDIR_HALF_DIRTY=true - elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + fi + if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then VCS_WORKDIR_DIRTY=true - else - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false + hook_com[unstaged]+=" $(print_icon 'VCS_STAGED_ICON')" fi } -- cgit v1.2.3 From 683ca10e369ae6699197e81f6fd5aec44c05c4f1 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 30 Aug 2016 20:29:36 -0400 Subject: vcs: adding detection of unstaged / staged for svn repos --- functions/icons.zsh | 7 +++++-- functions/vcs.zsh | 12 ++++++++---- powerlevel9k.zsh-theme | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'functions/vcs.zsh') diff --git a/functions/icons.zsh b/functions/icons.zsh index c2565f26..3542ce81 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,6 +69,7 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_GIT_ICON $'\UE20E ' #  VCS_HG_ICON $'\UE1C3 ' #  + VCS_SVN_ICON '(svn) ' RUST_ICON '' PYTHON_ICON $'\U1F40D' # 🐍 ) @@ -122,7 +123,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  - RUST_ICON $'\UE6A8' #  + VCS_SVN_ICON '(svn) ' + RUST_ICON $'\UE6A8' #  PYTHON_ICON $'\U1F40D' # 🐍 ) ;; @@ -175,7 +177,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' - RUST_ICON '' + VCS_SVN_ICON '' + RUST_ICON '' PYTHON_ICON '' ) ;; diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 50b58fbf..9418df81 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -113,8 +113,8 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_ICON' elif [[ "${hook_com[vcs]}" == "hg" ]]; then vcs_visual_identifier='VCS_HG_ICON' -# elif [[ "${hook_com[vcs]}" == "svn" ]]; then -# vcs_visual_identifier='VCS_SVN_ICON' + elif [[ "${hook_com[vcs]}" == "svn" ]]; then + vcs_visual_identifier='VCS_SVN_ICON' fi if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then @@ -127,11 +127,15 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then - hook_com[unstaged]+=" $(print_icon 'VCS_STASH_ICON')" + hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')" VCS_WORKDIR_HALF_DIRTY=true fi + if [[ -n "$(echo "$svn_status" | grep \^\M)" ]]; then + hook_com[unstaged]+=" $(print_icon 'VCS_UNSTAGED_ICON')" + VCS_WORKDIR_DIRTY=true + fi if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + hook_com[staged]+=" $(print_icon 'VCS_STAGED_ICON')" VCS_WORKDIR_DIRTY=true - hook_com[unstaged]+=" $(print_icon 'VCS_STAGED_ICON')" fi } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 3d7a913a..bf09b4ce 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -876,7 +876,7 @@ prompt_vcs() { zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS - defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(svn-detect-changes) + defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes) zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS # For Hg, only show the branch name -- cgit v1.2.3 From 3f1f11a1f1fa18d8bb250b03c45ca6fc49bfbfd9 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 26 Sep 2016 13:54:43 -0400 Subject: bugfix: typo in "POWERLEVEL9K" broke the VCS tag display --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9418df81..f1ff8891 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -62,7 +62,7 @@ function +vi-git-remotebranch() { set_default POWERLEVEL9K_VCS_HIDE_TAGS false function +vi-git-tagname() { - if [[ "$POWERLEVE9K_VCS_HIDE_TAGS" == "false" ]]; then + if [[ "$POWERLEVEL9K_VCS_HIDE_TAGS" == "false" ]]; then # If we are on a tag, append the tagname to the current branch string. local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) -- cgit v1.2.3 From bddbdd62e841d6e008e95fe2f0909d5b32e623a8 Mon Sep 17 00:00:00 2001 From: Matt Traynham Date: Wed, 19 Oct 2016 09:35:23 -0400 Subject: Fix '+vi-svn-detect-changes:local:1: not valid in this context' --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'functions/vcs.zsh') diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9418df81..a0aa2b6c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -125,7 +125,7 @@ function +vi-vcs-detect-changes() { } function +vi-svn-detect-changes() { - local svn_status=$(svn status) + local svn_status="$(svn status)" if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')" VCS_WORKDIR_HALF_DIRTY=true -- cgit v1.2.3