diff --git a/share/tools/web_config/sample_prompts/robbyrussell.fish b/share/tools/web_config/sample_prompts/robbyrussell.fish index f539027df..ccc48bd9d 100644 --- a/share/tools/web_config/sample_prompts/robbyrussell.fish +++ b/share/tools/web_config/sample_prompts/robbyrussell.fish @@ -22,7 +22,7 @@ function fish_prompt function _is_git_repo type -q git or return 1 - git status -s >/dev/null 2>/dev/null + git rev-parse --git-dir >/dev/null 2>&1 end function _hg_branch_name @@ -40,19 +40,22 @@ function fish_prompt end function _repo_branch_name - eval "_$argv[1]_branch_name" + _$argv[1]_branch_name end function _is_repo_dirty - eval "_is_$argv[1]_dirty" + _is_$argv[1]_dirty end function _repo_type if _is_hg_repo echo 'hg' + return 0 else if _is_git_repo echo 'git' + return 0 end + return 1 end end @@ -75,8 +78,7 @@ function fish_prompt set -l cwd $cyan(basename (prompt_pwd)) - set -l repo_type (_repo_type) - if [ $repo_type ] + if set -l repo_type (_repo_type) set -l repo_branch $red(_repo_branch_name $repo_type) set repo_info "$blue $repo_type:($repo_branch$blue)"