mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +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
|
end
|
||||||
|
|
||||||
function __fish_git_branches
|
function __fish_git_branches
|
||||||
command git branch --no-color -a --format='%(refname)' $argv ^/dev/null \
|
command git branch --no-color -a $argv ^/dev/null \
|
||||||
# Filter out anything that's not in "refs/" notation -
|
# Filter out detached heads and such ("(HEAD detached at SOMESHA)", localized).
|
||||||
# this happens mostly with a detached head ("(HEAD detached at SOMESHA)", localized).
|
| string match -v '\* (*)' | string match -r -v ' -> ' | string trim -c "* " \
|
||||||
| string replace -rf '^refs/' '' \
|
|
||||||
# We assume anything that's not remote is a local branch.
|
# 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'
|
| string replace -r "^remotes/(.*)" '$1\tRemote Branch'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue