Update __fish_git_prompt.fish to use 'else if'

This commit is contained in:
Kevin Ballard 2013-01-29 11:39:28 -08:00 committed by ridiculousfish
parent 3f8baeba20
commit 32b2c9fc9e

View File

@ -157,12 +157,10 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream (/bin/sh -c 'echo "${1%/$2}"' -- $pattern $trunk)/$upstream set upstream (/bin/sh -c 'echo "${1%/$2}"' -- $pattern $trunk)/$upstream
end end
end end
else else if test $upstream = svn+git
if test $upstream = svn+git
set upstream '@{upstream}' set upstream '@{upstream}'
end end
end end
end
# Find how many commits we are ahead/behind our upstream # Find how many commits we are ahead/behind our upstream
set -l count set -l count
@ -225,29 +223,25 @@ function __fish_git_prompt --description "Prompt function for Git"
if test -f $git_dir/rebase-merge/interactive if test -f $git_dir/rebase-merge/interactive
set r "|REBASE-i" set r "|REBASE-i"
set b (cat $git_dir/rebase-merge/head-name) set b (cat $git_dir/rebase-merge/head-name)
else; if test -d $git_dir/rebase-merge else if test -d $git_dir/rebase-merge
set r "|REBASE-m" set r "|REBASE-m"
set b (cat $git_dir/rebase-merge/head-name) set b (cat $git_dir/rebase-merge/head-name)
else else
if test -d $git_dir/rebase-apply if test -d $git_dir/rebase-apply
if test -f $git_dir/rebase-apply/rebasing if test -f $git_dir/rebase-apply/rebasing
set r "|REBASE" set r "|REBASE"
else; if test -f $git_dir/rebase-apply/applying else if test -f $git_dir/rebase-apply/applying
set r "|AM" set r "|AM"
else else
set r "|AM/REBASE" set r "|AM/REBASE"
end end
end else if test -f $git_dir/MERGE_HEAD
else; if test -f $git_dir/MERGE_HEAD
set r "|MERGING" set r "|MERGING"
else; if test -f $git_dir/CHERRY_PICK_HEAD else if test -f $git_dir/CHERRY_PICK_HEAD
set r "|CHERRY-PICKING" set r "|CHERRY-PICKING"
else; if test -f $git_dir/BISECT_LOG else if test -f $git_dir/BISECT_LOG
set r "|BISECTING" set r "|BISECTING"
end end
end
end
end
set -l os set -l os
set b (git symbolic-ref HEAD ^/dev/null; set os $status) set b (git symbolic-ref HEAD ^/dev/null; set os $status)
@ -271,7 +265,6 @@ function __fish_git_prompt --description "Prompt function for Git"
set b "($b)" set b "($b)"
end end
end end
end
set -l w set -l w
set -l i set -l i
@ -288,7 +281,7 @@ function __fish_git_prompt --description "Prompt function for Git"
else else
set b "GIT_DIR!" set b "GIT_DIR!"
end end
else; if test "true" = (git rev-parse --is-inside-work-tree ^/dev/null) else if test "true" = (git rev-parse --is-inside-work-tree ^/dev/null)
if test -n "$__fish_git_prompt_showdirtystate" if test -n "$__fish_git_prompt_showdirtystate"
set -l config (git config --bool bash.showDirtyState) set -l config (git config --bool bash.showDirtyState)
if test "$config" != "false" if test "$config" != "false"
@ -315,7 +308,6 @@ function __fish_git_prompt --description "Prompt function for Git"
set p (__fish_git_prompt_show_upstream) set p (__fish_git_prompt_show_upstream)
end end
end end
end
__fish_git_prompt_validate_colors __fish_git_prompt_validate_colors