aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-09-06 14:58:09 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-09-06 14:58:09 +0200
commitcb5511c8db9330c26b4bd6ac63893c875cca72c8 (patch)
tree2d1ddde252687e523f21a5f9e6c102eb655568f6 /share
parent54b6a1c08e2e3fefd0b052ccc4bf57a92588330a (diff)
Vcs prompt: Break if vcs isn't installed
Prevents an annoying error message. Fixes #2363.
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_git_prompt.fish5
-rw-r--r--share/functions/__fish_hg_prompt.fish5
-rw-r--r--share/functions/__terlar_git_prompt.fish5
3 files changed, 15 insertions, 0 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index dc3f1112..4fb2f16c 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -346,6 +346,11 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
end
function __fish_git_prompt --description "Prompt function for Git"
+ # If git isn't installed, there's nothing we can do
+ # Return 1 so the calling prompt can deal with it
+ if not command -s git >/dev/null
+ return 1
+ end
set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD ^/dev/null)
test -n "$repo_info"; or return
diff --git a/share/functions/__fish_hg_prompt.fish b/share/functions/__fish_hg_prompt.fish
index a982d537..769adfb6 100644
--- a/share/functions/__fish_hg_prompt.fish
+++ b/share/functions/__fish_hg_prompt.fish
@@ -21,6 +21,11 @@ set -g fish_prompt_hg_status_unmerged '!'
set -g fish_prompt_hg_status_order added modified copied deleted untracked unmerged
function __fish_hg_prompt --description 'Write out the hg prompt'
+ # If hg isn't installed, there's nothing we can do
+ # Return 1 so the calling prompt can deal with it
+ if not command -s hg >/dev/null
+ return 1
+ end
set -l branch (hg branch ^/dev/null)
if test -z $branch
return
diff --git a/share/functions/__terlar_git_prompt.fish b/share/functions/__terlar_git_prompt.fish
index c440e140..9b3c84a8 100644
--- a/share/functions/__terlar_git_prompt.fish
+++ b/share/functions/__terlar_git_prompt.fish
@@ -21,6 +21,11 @@ set -g fish_prompt_git_status_unmerged '!'
set -g fish_prompt_git_status_order added modified renamed copied deleted untracked unmerged
function __terlar_git_prompt --description 'Write out the git prompt'
+ # If git isn't installed, there's nothing we can do
+ # Return 1 so the calling prompt can deal with it
+ if not command -s git >/dev/null
+ return 1
+ end
set -l branch (git rev-parse --abbrev-ref HEAD ^/dev/null)
if test -z $branch
return