git-reset: Don't suggest branch completions if -- is present

If "--" is present in the command line, it's usually safe to assume that
the user is going to want to complete a file tracked by git so let's
only suggest branches if "--" isn't present.
This commit is contained in:
Collin Styles 2019-10-18 13:54:40 -07:00 committed by Johannes Altmanninger
parent 3de3a34e79
commit 63e840995e

View File

@ -1448,7 +1448,7 @@ complete -r -c git -n '__fish_git_using_command rebase' -l exec -d 'Execute shel
### reset
complete -c git -n '__fish_git_needs_command' -a reset -d 'Reset current HEAD to the specified state'
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset files in working directory'
complete -c git -n '__fish_git_using_command reset' -a '(__fish_git_branches)'
complete -c git -n '__fish_git_using_command reset; and not contains -- -- (commandline -op)' -a '(__fish_git_branches)'
# reset can either undo changes to versioned modified files,
# or remove files from the staging area.
# Deleted files seem to need a "--" separator.