X-Git-Url: https://git.alrj.org/?p=zsh.d.git;a=blobdiff_plain;f=S60_git;h=54e61d477ad110bc101814a157c7fdf88db7c995;hp=037e8b3aebb190ce5819caa6ba70b754f573e734;hb=4e8ef2688401ea492adc5ded48d85f447e9100ac;hpb=f65fa720ac776c80a6ee777c701865ca1f7b6088 diff --git a/S60_git b/S60_git index 037e8b3..54e61d4 100644 --- a/S60_git +++ b/S60_git @@ -1,17 +1,17 @@ #! /usr/bin/zsh -export __ZSH_GIT_BASEDIR="" -export __ZSH_GIT_SUBDIR="" -export __ZSH_GIT_BRANCH="" -export __ZSH_GIT_ACTION="" -export __ZSH_GIT_STATUS="" -export __ZSH_GIT_VARS_INVALID=1 -export __ZSH_GIT_STATUS_INVALID=1 +__ZSH_GIT_BASEDIR="" +__ZSH_GIT_SUBDIR="" +__ZSH_GIT_BRANCH="" +__ZSH_GIT_ACTION="" +__ZSH_GIT_STATUS="" +__ZSH_GIT_VARS_INVALID=1 +__ZSH_GIT_STATUS_INVALID=1 git_chpwd() { # On cd, invalidate git status in prompt - export __ZSH_GIT_VARS_INVALID=1 + __ZSH_GIT_VARS_INVALID=1 } @@ -19,12 +19,12 @@ git_preexec() { # On git command, invalidate git status in prompt case "$1" in git*) - export __ZSH_GIT_VARS_INVALID=1 + __ZSH_GIT_VARS_INVALID=1 ;; esac # *any* command could invalidate the repository status (new file, ...) - export __ZSH_GIT_STATUS_INVALID=1 + __ZSH_GIT_STATUS_INVALID=1 } @@ -52,11 +52,11 @@ git_get_status() { git_parse() { - # psvar[3] == current action (merge, rebase, ...) - # psvar[4] == current branch - # psvar[5] == repository base directory - # psvar[6] == current subdir into repository - # psvar[7] == status (untracked, unstaged, staged) + # psvar[5] == current action (merge, rebase, ...) + # psvar[6] == current branch + # psvar[7] == repository base directory + # psvar[8] == current subdir into repository + # psvar[9] == status (untracked, unstaged, staged) local git_dir ref base_dir sub_dir action branch gitstat gitstatus @@ -65,11 +65,11 @@ git_parse() { if [[ "${__ZSH_GIT_VARS_INVALID}" == "0" && "${__ZSH_GIT_STATUS_INVALID}" == "0" ]]; then # reuse previous values - psvar[3]=${__ZSH_GIT_ACTION} - psvar[4]=${__ZSH_GIT_BRANCH} - psvar[5]=${__ZSH_GIT_BASEDIR} - psvar[6]=${__ZSH_GIT_SUBDIR} - psvar[7]=${__ZSH_GIT_STATUS} + psvar[5]=${__ZSH_GIT_ACTION} + psvar[6]=${__ZSH_GIT_BRANCH} + psvar[7]=${__ZSH_GIT_BASEDIR} + psvar[8]=${__ZSH_GIT_SUBDIR} + psvar[9]=${__ZSH_GIT_STATUS} return fi @@ -78,15 +78,15 @@ git_parse() { if [[ "${__ZSH_GIT_VARS_INVALID}" == "0" && "${__ZSH_GIT_STATUS_INVALID}" == "1" ]]; then # reuse previous values - psvar[3]=${__ZSH_GIT_ACTION} - psvar[4]=${__ZSH_GIT_BRANCH} - psvar[5]=${__ZSH_GIT_BASEDIR} - psvar[6]=${__ZSH_GIT_SUBDIR} + psvar[5]=${__ZSH_GIT_ACTION} + psvar[6]=${__ZSH_GIT_BRANCH} + psvar[7]=${__ZSH_GIT_BASEDIR} + psvar[8]=${__ZSH_GIT_SUBDIR} - export __ZSH_GIT_STATUS=$(git_get_status) - psvar[7]=${__ZSH_GIT_STATUS} + __ZSH_GIT_STATUS=$(git_get_status) + psvar[9]=${__ZSH_GIT_STATUS} - export __ZSH_GIT_STATUS_INVALID=0 + __ZSH_GIT_STATUS_INVALID=0 return fi @@ -132,21 +132,21 @@ git_parse() { gitstatus=`git_get_status` # Got here, we're in git - psvar[3]=${action} - psvar[4]=${branch#refs/heads/} - psvar[5]=${base_dir} - psvar[6]=${sub_dir} - psvar[7]=${gitstatus} + psvar[5]=${action} + psvar[6]=${branch#refs/heads/} + psvar[7]=${base_dir} + psvar[8]=${sub_dir} + psvar[9]=${gitstatus} # Save for next time - export __ZSH_GIT_BASEDIR="${base_dir}" - export __ZSH_GIT_SUBDIR="${sub_dir}" - export __ZSH_GIT_BRANCH="${branch#refs/heads/}" - export __ZSH_GIT_ACTION="${action}" - export __ZSH_GIT_STATUS="${gitstatus}" - - export __ZSH_GIT_VARS_INVALID=0 - export __ZSH_GIT_STATUS_INVALID=0 + __ZSH_GIT_BASEDIR="${base_dir}" + __ZSH_GIT_SUBDIR="${sub_dir}" + __ZSH_GIT_BRANCH="${branch#refs/heads/}" + __ZSH_GIT_ACTION="${action}" + __ZSH_GIT_STATUS="${gitstatus}" + + __ZSH_GIT_VARS_INVALID=0 + __ZSH_GIT_STATUS_INVALID=0 }