From ce744ec012a6a10ae8dfedc553eacaa6be924668 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 24 Aug 2013 16:27:09 +1200 Subject: Bail if git status fails while building prompt --- bash/bashrc.d/prompt.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bash') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 9de8471a..83419856 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -51,8 +51,10 @@ prompt() { fi # Read the repository's status to refresh its info; ignore all the - # output - git status &>/dev/null + # output; give up if this fails + if ! git status &>/dev/null; then + return 1 + fi # Figure out the branch to show for HEAD, whether a symbolic # reference or a short SHA-1; chop off any leading path -- cgit v1.2.3