From bca17db96ebb8bfb70223ed5f21e711a33dc5251 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 9 Sep 2017 23:35:04 -0500 Subject: [PATCH] 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. --- share/completions/git.fish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 34b82a144..fb74035df 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -362,11 +362,11 @@ complete -f -c git -n '__fish_git_using_command add' -a '(__fish_git_add_files)' ### 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_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 -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 -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_branches)' --description 'Branch' +complete -k -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_unique_remote_branches)' --description 'Remote branch' +complete -k -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_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 t -l track -d 'Track a new branch' complete -f -c git -n '__fish_git_using_command checkout' -l theirs -d 'Keep staged changes'