git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: remote set-* <name> and <branch>
@ 2012-02-18 13:32 Philip Jägenstedt
  2012-02-20  7:58 ` Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Philip Jägenstedt @ 2012-02-18 13:32 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Philip Jägenstedt

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 <philip@foolip.org>
---
 contrib/completion/git-completion.bash |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1505cff..8e7abb6 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -738,6 +738,9 @@ __git_complete_remote_or_refspec ()
 {
 	local cur_="$cur" cmd="${words[1]}"
 	local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
+	if [ "$cmd" = "remote" ]; then
+		c=$((++c))
+	fi
 	while [ $c -lt $cword ]; do
 		i="${words[c]}"
 		case "$i" in
@@ -788,7 +791,7 @@ __git_complete_remote_or_refspec ()
 			__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
 		fi
 		;;
-	pull)
+	pull|remote)
 		if [ $lhs = 1 ]; then
 			__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
 		else
@@ -2289,7 +2292,7 @@ _git_config ()
 
 _git_remote ()
 {
-	local subcommands="add rename rm show prune update set-head"
+	local subcommands="add rename rm set-head set-branches set-url show prune update"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
 		__gitcomp "$subcommands"
@@ -2297,9 +2300,12 @@ _git_remote ()
 	fi
 
 	case "$subcommand" in
-	rename|rm|show|prune)
+	rename|rm|set-url|show|prune)
 		__gitcomp_nl "$(__git_remotes)"
 		;;
+	set-head|set-branches)
+		__git_complete_remote_or_refspec
+		;;
 	update)
 		local i c='' IFS=$'\n'
 		for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do
-- 
1.7.9.1.245.g4cbe6

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-02-22 22:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-18 13:32 [PATCH] completion: remote set-* <name> and <branch> Philip Jägenstedt
2012-02-20  7:58 ` Junio C Hamano
2012-02-21 21:29   ` Philip Jägenstedt
2012-02-21 21:54     ` [PATCH v2] " Philip Jägenstedt
2012-02-22  0:17       ` SZEDER Gábor
2012-02-22  8:58         ` [PATCH v3] " Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 1/4] " Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 2/4] completion: normalize increment/decrement style Philip Jägenstedt
2012-02-22 22:05             ` Junio C Hamano
2012-02-22  8:58           ` [PATCH 3/4] completion: remove stale "to submit patches" documentation Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 4/4] completion: use tabs for indentation Philip Jägenstedt
2012-02-22  9:52           ` [PATCH v3] completion: remote set-* <name> and <branch> Thomas Rast
2012-02-21 22:23     ` [PATCH] " Junio C Hamano
2012-02-22  0:03       ` SZEDER Gábor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).