Preserve git's own ordering of branch/tag completions for checkout

Addresses the main concern of #3830 by preserving the internal ordering
of tag/branch listings generated by git. Fixes mixing of remote and
local branches in completions.

Does not address the concern of having local branches on top, remote
branches after, and tags at the bottom - I don't believe we have that
functionality available to us yet. #361 only implemented sort within a
category of completions, but there is no category "weight" unless I'm
mistaken.
This commit is contained in:
Mahmoud Al-Qudsi 2017-09-09 23:35:04 -05:00
parent 55b3c45f95
commit bca17db96e

View file

@ -362,11 +362,11 @@ complete -f -c git -n '__fish_git_using_command add' -a '(__fish_git_add_files)'
### checkout ### checkout
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch' complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch' complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_heads)' --description 'Head' complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_heads)' --description 'Head'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_unique_remote_branches)' --description 'Remote branch' complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_unique_remote_branches)' --description 'Remote branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag' complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_modified_files)' --description 'File' complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_modified_files)' --description 'File'
complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch' complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
complete -f -c git -n '__fish_git_using_command checkout' -s t -l track -d 'Track a new branch' complete -f -c git -n '__fish_git_using_command checkout' -s t -l track -d 'Track a new branch'
complete -f -c git -n '__fish_git_using_command checkout' -l theirs -d 'Keep staged changes' complete -f -c git -n '__fish_git_using_command checkout' -l theirs -d 'Keep staged changes'