mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Vcs prompt: Break if vcs isn't installed
Prevents an annoying error message. Fixes #2363.
This commit is contained in:
parent
54b6a1c08e
commit
cb5511c8db
3 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue