From 74ba9606de1b578779e459436ac38d269904fc54 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 20 Jun 2016 11:42:16 -0400 Subject: Check one directory up for .git/HEAD --- .zshrc | 7 ++++--- 1 file 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}";; -- cgit 1.4.1