From f41485a296e6755f0b460472988b5ef226333a64 Mon Sep 17 00:00:00 2001 From: Colin Hebert Date: Wed, 14 Mar 2012 22:12:22 +0000 Subject: [PATCH] Git-plugin: Get the current action externally The current action hasn't anything to do with git status --- plugins/git/functions/git-info | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 976bc036..0a8c4f1b 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -235,14 +235,6 @@ function git-info() { (( line_number++ )) if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then - # Get action. - action="$(_git-action)" - - # Format action. - if [[ -n "$action" ]]; then - zstyle -s ':omz:plugin:git:prompt' action 'action_format' - zformat -f action_formatted "$action_format" "s:$action" - fi elif (( line_number == 1 )) \ && [[ "$line" == (#b)'## Initial commit on '(?##) ]]; then elif (( line_number == 1 )); then @@ -270,6 +262,13 @@ function git-info() { fi done < <("${(z)status_cmd}" 2>/dev/null) + # Format action. + action="$(_git-action)" + if [[ -n "$action" ]]; then + zstyle -s ':omz:plugin:git:prompt' action 'action_format' + zformat -f action_formatted "$action_format" "s:$action" + fi + # Get current status. while IFS=$'\n' read line; do # Count added, deleted, modified, renamed, unmerged, untracked, dirty.