From 00fc1306d07c9912e93f0b6d5349de7f2cda60dc Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 19 Oct 2019 16:05:39 +0200 Subject: [PATCH] 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. --- share/completions/git.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index acc4ebce7..c6d0caa0a 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -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/'