mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
[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.
This commit is contained in:
parent
3792fb086a
commit
754b52bb26
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue