Skip to content

Commit f1c6ffe

Browse files
foolipgitster
authored andcommitted
completion: remote set-* <name> and <branch>
Complete <name> only for set-url. For set-branches and set-head, complete <name> and <branch> over the network, like e.g. git pull already does. Signed-off-by: Philip Jägenstedt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 514a529 commit f1c6ffe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

contrib/completion/git-completion.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ __git_complete_remote_or_refspec ()
726726
{
727727
local cur_="$cur" cmd="${words[1]}"
728728
local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
729+
if [ "$cmd" = "remote" ]; then
730+
c=$((++c))
731+
fi
729732
while [ $c -lt $cword ]; do
730733
i="${words[c]}"
731734
case "$i" in
@@ -776,7 +779,7 @@ __git_complete_remote_or_refspec ()
776779
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
777780
fi
778781
;;
779-
pull)
782+
pull|remote)
780783
if [ $lhs = 1 ]; then
781784
__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
782785
else
@@ -2277,17 +2280,20 @@ _git_config ()
22772280

22782281
_git_remote ()
22792282
{
2280-
local subcommands="add rename rm show prune update set-head"
2283+
local subcommands="add rename rm set-head set-branches set-url show prune update"
22812284
local subcommand="$(__git_find_on_cmdline "$subcommands")"
22822285
if [ -z "$subcommand" ]; then
22832286
__gitcomp "$subcommands"
22842287
return
22852288
fi
22862289

22872290
case "$subcommand" in
2288-
rename|rm|show|prune)
2291+
rename|rm|set-url|show|prune)
22892292
__gitcomp_nl "$(__git_remotes)"
22902293
;;
2294+
set-head|set-branches)
2295+
__git_complete_remote_or_refspec
2296+
;;
22912297
update)
22922298
local i c='' IFS=$'\n'
22932299
for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do

0 commit comments

Comments
 (0)