From 754b52bb261cba3fae310a959e7951f866bc6d84 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 6 Mar 2018 22:02:43 +0100 Subject: [PATCH] [git completions] Make branches work on git 2.7.0 again This used the "--format" option, which was only added in git 2.13.0. --- share/completions/git.fish | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 9427538f1..70024a0a0 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -19,12 +19,11 @@ function __fish_git_recent_commits end function __fish_git_branches - command git branch --no-color -a --format='%(refname)' $argv ^/dev/null \ - # Filter out anything that's not in "refs/" notation - - # this happens mostly with a detached head ("(HEAD detached at SOMESHA)", localized). - | string replace -rf '^refs/' '' \ + command git branch --no-color -a $argv ^/dev/null \ + # Filter out detached heads and such ("(HEAD detached at SOMESHA)", localized). + | string match -v '\* (*)' | string match -r -v ' -> ' | string trim -c "* " \ # We assume anything that's not remote is a local branch. - | string replace -r '^(?!remotes/)[^/]+/(.*)' '$1\tLocal Branch' \ + | string replace -r '^(?!remotes/)(.*)' '$1\tLocal Branch' \ | string replace -r "^remotes/(.*)" '$1\tRemote Branch' end