diff options
author | June McEnroe <june@causal.agency> | 2016-06-20 11:42:16 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2016-06-20 11:42:16 -0400 |
commit | 74ba9606de1b578779e459436ac38d269904fc54 (patch) | |
tree | a234121947fd82bdd37ac55641acc3d1b3df787b | |
parent | Set undofile (diff) | |
download | src-74ba9606de1b578779e459436ac38d269904fc54.tar.gz src-74ba9606de1b578779e459436ac38d269904fc54.zip |
Check one directory up for .git/HEAD
Diffstat (limited to '')
-rw-r--r-- | .zshrc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/.zshrc b/.zshrc index 35b45c2c..97487520 100644 --- a/.zshrc +++ b/.zshrc @@ -45,9 +45,10 @@ alias gl='git log --graph --pretty=log' setopt prompt_subst [[ -n "$SSH_CLIENT" ]] && _prompt_ssh="$fg[magenta]" _prompt_git() { - [[ -f .git/HEAD ]] || return 0 - local head - read head < .git/HEAD + local dotgit=.git head + [[ -d "$dotgit" ]] || dotgit=../.git + [[ -d "$dotgit" ]] || return 0 + read head < "$dotgit/HEAD" case "$head" in ref:*) echo ":${head#*/*/}";; *) echo ":${head:0:7}";; |