From 7c0312c797b939d4e29bf1328dd0a855183275c8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 18 Aug 2016 12:12:24 +1200 Subject: Don't do Git prompt work if not in working tree --- bash/bashrc.d/prompt.bash | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bash/bashrc.d/prompt.bash') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 23c89857..081cff69 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -104,6 +104,13 @@ prompt() { return 1 fi + # Bail if we're not in a work tree + local iswt + iswt=$(git rev-parse --is-inside-work-tree 2>/dev/null) + if [[ $iswt != true ]] ; then + return 1 + fi + # Attempt to determine git branch, bail if we can't local branch branch=$( { -- cgit v1.2.3