diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 12:12:24 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 12:12:24 +1200 |
commit | 7c0312c797b939d4e29bf1328dd0a855183275c8 (patch) | |
tree | 460c411296908c4be343c19b1086d4a1759e0a8a /bash | |
parent | Use explicit -n test within [[ ]] (diff) | |
download | dotfiles-7c0312c797b939d4e29bf1328dd0a855183275c8.tar.gz dotfiles-7c0312c797b939d4e29bf1328dd0a855183275c8.zip |
Don't do Git prompt work if not in working tree
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 7 |
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=$( { |