aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-09-10 14:15:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-09-10 14:15:15 +1200
commiteb63f48e136e1e36f57f47c83e15d74ab4cbcc65 (patch)
tree834d53099e6e61b4238e54f54fbcb4556971e3c5
parentUse builtins only for prompt job count (diff)
downloaddotfiles-eb63f48e136e1e36f57f47c83e15d74ab4cbcc65.tar.gz
dotfiles-eb63f48e136e1e36f57f47c83e15d74ab4cbcc65.zip
Fail early if VCS binaries not found
-rw-r--r--bash/bashrc.d/prompt.bash15
1 files changed, 15 insertions, 0 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 8927e732..6864ce19 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -40,6 +40,11 @@ prompt() {
# Git prompt function
git)
+ # Bail if we have no git(1)
+ if ! hash git 2>/dev/null; then
+ return 1
+ fi
+
# Exit if inside a .git directory
local gitdir=$(git rev-parse --is-inside-git-dir 2>/dev/null)
if [[ $gitdir == true ]]; then
@@ -99,6 +104,11 @@ prompt() {
# Mercurial prompt function
hg)
+ # Bail if we have no hg(1)
+ if ! hash hg 2>/dev/null; then
+ return 1
+ fi
+
# Exit if not inside a Mercurial tree
local branch
if ! branch=$(hg branch 2>/dev/null); then
@@ -121,6 +131,11 @@ prompt() {
# Subversion prompt function
svn)
+ # Bail if we have no svn(1)
+ if ! hash svn 2>/dev/null; then
+ return 1
+ fi
+
# Exit if not inside a Subversion working copy
if ! svn info >/dev/null 2>&1; then
return 1