From 0882e0cb9550e1f12c69f51032241158c6148e03 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 29 May 2016 14:07:15 +0200 Subject: Git prompt: Remove legacy option Git has supported `rev-list --count` for years, so this shouldn't be needed anymore. --- share/functions/__fish_git_prompt.fish | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'share') diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index ced41357..909dd6bd 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -53,8 +53,6 @@ # verbose show number of commits ahead/behind (+/-) upstream # name if verbose, then also show the upstream abbrev name # informative similar to verbose, but shows nothing when equal (fish only) -# legacy don't use the '--count' option available in recent versions -# 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) @@ -178,7 +176,6 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi set -l svn_url_pattern set -l count set -l upstream git - set -l legacy set -l verbose set -l name @@ -222,9 +219,6 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi set -e informative case informative set informative 1 - case legacy - set legacy 1 - set -e informative case name set name 1 case none @@ -279,20 +273,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi end # Find how many commits we are ahead/behind our upstream - if test -z "$legacy" - set count (command git rev-list --count --left-right $upstream...HEAD ^/dev/null) - else - # produce equivalent output to --count for older versions of git - set -l os - set -l commits (command git rev-list --left-right $upstream...HEAD ^/dev/null; set os $status) - if test $os -eq 0 - set -l behind (count (for arg in $commits; echo $arg; end | string match -r '^<')) - set -l ahead (count (for arg in $commits; echo $arg; end | string match -r -v '^<')) - set count "$behind $ahead" - else - set count - end - end + set count (command git rev-list --count --left-right $upstream...HEAD ^/dev/null) # calculate the result if test -n "$verbose" -- cgit v1.2.3