3 export __ZSH_GIT_BASEDIR=""
4 export __ZSH_GIT_BRANCH=""
5 export __ZSH_GIT_SUBDIR=""
6 export __ZSH_GIT_STATE=""
7 export __ZSH_GIT_VARS_INVALID=1
11 local git_dir ref base_dir sub_dir action branch
13 git_dir=$(git rev-parse --git-dir 2> /dev/null) || return
15 base_dir=${$(readlink -f "$git_dir/..")/$HOME/'~'}
17 sub_dir=$(git rev-parse --show-prefix)
19 ref=$(git symbolic-ref HEAD 2> /dev/null) || return
23 if [ -d "$git_dir/../.dotest" ]; then
24 if [ -f "$git_dir/../.dotest/rebasing" ]; then
26 elif [ -f "$git_dir/../.dotest/applying" ]; then
32 elif [ -f "$git_dir/.dotest-merge/interactive" ]; then
34 branch="$(cat "$git_dir/.dotest-merge/head-name")"
35 elif [ -d "$git_dir/.dotest-merge" ]; then
37 branch="$(cat "$git_dir/.dotest-merge/head-name")"
38 elif [ -f "$git_dir/MERGE_HEAD" ]; then
42 test -f "$git_dir/BISECT_LOG" && psvar[3]="bisect"
43 branch="$(git symbolic-ref HEAD 2>/dev/null)" || \
44 branch="$(git describe --exact-match HEAD 2>/dev/null)" || \
45 branch="$(cut -c1-7 "$git_dir/HEAD")..."
48 # Got here, we're in git
49 psvar[4]=${branch#refs/heads/}
54 precmd_functions+='git_parse'