aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-18 12:12:24 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-18 12:12:24 +1200
commit7c0312c797b939d4e29bf1328dd0a855183275c8 (patch)
tree460c411296908c4be343c19b1086d4a1759e0a8a /bash/bashrc.d
parentUse explicit -n test within [[ ]] (diff)
downloaddotfiles-7c0312c797b939d4e29bf1328dd0a855183275c8.tar.gz
dotfiles-7c0312c797b939d4e29bf1328dd0a855183275c8.zip
Don't do Git prompt work if not in working tree
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/prompt.bash7
1 files changed, 7 insertions, 0 deletions
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=$( {