aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-19 14:11:27 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-19 14:11:27 +0200
commit9cee3f13a1ef14c00b5ff4c2bdbaed65a619646b (patch)
tree373058fee56fbdbed087b825a2d998941545a425 /share/completions
parent8dc74de92e12ed6c49e4c34273a7081481ceb85d (diff)
Implement src:dest for git push completion
This allows specifying a local branch to push to a certain remote branch. Fixes #3035.
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/git.fish6
1 files changed, 4 insertions, 2 deletions
diff --git a/share/completions/git.fish b/share/completions/git.fish
index 1bdec5cc..3f2a3b1c 100644
--- a/share/completions/git.fish
+++ b/share/completions/git.fish
@@ -439,10 +439,12 @@ 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'
+# The "refspec" here is an optional "+" to signify a force-push
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'
+# 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):(__fish_git_branch_for_remote)' -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):(__fish_git_branch_for_remote)' -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/'