diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index dc3f11120..4fb2f16c8 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 a982d5379..769adfb65 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 c440e140e..9b3c84a85 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