From 1964b04ea9d3bcddd5cfed2b2abe5a2adb69856b Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Sat, 27 Jul 2013 11:04:54 -0400 Subject: [PATCH] git_prompt: Show upstream with informative status This makes $__fish_git_prompt_show_informative_status imply $__fish_git_prompt_showupstream = "informative", while adding a none option for showupstream to disable it if desired. --- share/functions/__fish_git_prompt.fish | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index 485f5d1d4..a36dab29a 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -56,6 +56,7 @@ # of git-rev-list # git always compare HEAD to @{upstream} # svn always compare HEAD to your SVN upstream +# none disables (fish only, useful with show_informative_status) # # By default, __fish_git_prompt will compare HEAD to your SVN upstream if it # can find one, or @{upstream} otherwise. Once you have set @@ -84,12 +85,14 @@ # An "informative git prompt" mode similar to the scripts for bash and zsh # can be activated by setting __fish_git_prompt_show_informative_status # This works more like the "informative git prompt" scripts for bash and zsh, -# giving prompts like (master|+1#2*3%4) where master is the current branch -# and you have 1 staged, 2 unmerged, 3 dirty, and 4 untracked files. If you -# have no changes, it displays (master|.). The characters and colors can be -# customized as below, with the following names: +# giving prompts like (master >1<2|+3#4*5%6) where master is the current branch, +# you have 1 commit your upstream doesn't and it has 2 you don't, and you have +# 3 staged, 4 unmerged, 5 dirty, and 6 untracked files. If you have no +# changes, it displays (master|.). The characters and colors can be customized +# as below, with the following names: # -# dirtystate, invalidstate, stagedstate, untrackedfiles, cleanstate +# upstream_prefix, upstream_ahead, upstream_behind, dirtystate, +# invalidstate, stagedstate, untrackedfiles, cleanstate # # The color for each component of the prompt can specified using # __fish_git_prompt_color_, where is one of the following and the @@ -205,6 +208,8 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi case legacy set legacy 1 set -e informative + case none + return end end @@ -363,7 +368,7 @@ function __fish_git_prompt --description "Prompt function for Git" end end - if test -n "$__fish_git_prompt_showupstream" + if test -n "$__fish_git_prompt_showupstream" -o "$__fish_git_prompt_show_informative_status" set p (__fish_git_prompt_show_upstream) end end