summary refs log tree commit diff
path: root/.zshrc
diff options
context:
space:
mode:
authorJune McEnroe <curtis.mcenroe@adgear.com>2016-06-20 11:42:16 -0400
committerJune McEnroe <curtis.mcenroe@adgear.com>2016-06-20 11:42:16 -0400
commit068c4ad2227b2e390e117b74a1e6d205cd602d17 (patch)
tree4c92fb8265ee07cd8dd6c461ccac9d274128c3ea /.zshrc
parentSet undofile (diff)
downloadsrc-068c4ad2227b2e390e117b74a1e6d205cd602d17.tar.gz
src-068c4ad2227b2e390e117b74a1e6d205cd602d17.zip
Check one directory up for .git/HEAD
Diffstat (limited to '.zshrc')
-rw-r--r--.zshrc7
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}";;