aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-04-30 16:30:02 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-04-30 16:35:14 +0200
commit404ab5e9ab2ba2f0eb9df797993524348b95d586 (patch)
tree21f66c30bd0a7f3dc09050c600b583265a51aa83 /share
parent901652d5c37cd60131238fd29af9bc57ec2acdbf (diff)
git completion: Allow optional "+" for push
This signifies a force-push. To avoid cluttering, only complete branches if a + is already given. Fixes #2879. (cherry picked from commit fde26d404956f843860f2bf5bb00dd3e1636632a)
Diffstat (limited to 'share')
-rw-r--r--share/completions/git.fish3
1 files changed, 3 insertions, 0 deletions
diff --git a/share/completions/git.fish b/share/completions/git.fish
index a6bce22d..e4e0ba36 100644
--- a/share/completions/git.fish
+++ b/share/completions/git.fish
@@ -417,7 +417,10 @@ complete -f -c git -n '__fish_git_using_command pull; and __fish_git_branch_for_
### push
complete -f -c git -n '__fish_git_needs_command' -a push -d 'Update remote refs along with associated objects'
complete -f -c git -n '__fish_git_using_command push; and not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
+# The "refspec" here is an optional "+" to signify a force-push (implemented)
+# then src:dest (where both src and dest are git objects, so we most likely want to complete branches (not implemented)
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote' -a '(__fish_git_branches)' -d '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)' -d 'Force-push 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/'