* Improved speed, the first time cd'ing into a git repo the prompt
returns much faster (for me at least).
* Prompt is now decorated in nested folders within a git repo. No
longer check for the '.git' folder.
... | ... |
@@ -11,16 +11,10 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" |
11 | 11 |
|
12 | 12 |
# get the name of the branch we are on |
13 | 13 |
function git_prompt_info() { |
14 |
- if [[ -d .git ]]; then |
|
15 |
- ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
|
16 |
- branch=${ref#refs/heads/} |
|
17 |
- CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
|
18 |
- else |
|
19 |
- CURRENT_BRANCH='' |
|
20 |
- fi |
|
21 |
- |
|
22 |
- echo $CURRENT_BRANCH |
|
14 |
+ ref=$(git-symbolic-ref HEAD 2> /dev/null) || return |
|
15 |
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
|
23 | 16 |
} |
17 |
+ |
|
24 | 18 |
parse_git_dirty () { |
25 | 19 |
if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then |
26 | 20 |
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" |