mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 12:32:01 +08:00
completions/git: allow arbitrary refs in git push remote src:dest
When there is already a "src:", we assume that it is a valid ref and just complete "dst". This allows completion of dest if src is e.g. a commit SHA (completing all possible refs would probably impact performance). See issue #3035.
This commit is contained in:
parent
aa1bf9f277
commit
00fc1306d0
|
@ -1387,8 +1387,8 @@ complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_
|
|||
# git push REMOTE :BRANCH deletes BRANCH on remote REMOTE
|
||||
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q ":*" -- (commandline -ct)' -a ':(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Delete remote branch'
|
||||
# then src:dest (where both src and dest are git objects, so we want to complete branches)
|
||||
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "+*:*" -- (commandline -ct)' -a '+(__fish_git_branches | string replace -r \t".*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Force-push local branch to remote branch'
|
||||
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "*:*" -- (commandline -ct)' -a '(__fish_git_branches | string replace -r \t".*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Push local branch to remote branch'
|
||||
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "+*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Force-push local branch to remote branch'
|
||||
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Push local branch to remote branch'
|
||||
complete -f -c git -n '__fish_git_using_command push' -l all -d 'Push all refs under refs/heads/'
|
||||
complete -f -c git -n '__fish_git_using_command push' -l prune -d "Remove remote branches that don't have a local counterpart"
|
||||
complete -f -c git -n '__fish_git_using_command push' -l mirror -d 'Push all refs under refs/'
|
||||
|
|
Loading…
Reference in New Issue
Block a user