git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-completion: offer remotes for 'git remote update'

From
Auke Schrijnen <auke@schrijnen.nl>
Date
Sep 28, 2011, 08:54 UTC
Message-ID
<1fe2227149aa8b1024dd0f220e32af20@schrijnen.nl>
In-Reply-To
<7v8vp9trvu.fsf@alter.siamese.dyndns.org>

Completion for 'git remote update' only offers configured remote groups. This is fine if one uses remote groups but there is no completion without those groups.

Add all remotes to the completion when no configured groups are found.
Signed-off-by: Auke Schrijnen <auke@schrijnen.nl>
---
  contrib/completion/git-completion.bash |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 8648a36..12058bf 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2298,7 +2298,11 @@ _git_remote ()
  			i="${i#remotes.}"
  			c="$c ${i/ */}"
  		done
-		__gitcomp "$c"
+		if [ -z "$c" ]; then
+			__gitcomp "$(__git_remotes)"
+		else
+			__gitcomp "$c"
+		fi
  		;;
  	*)
  		COMPREPLY=()
-- 
1.7.6.1
Previous: Auke Schrijnen
Message 4 of 4 in “git-completion: offer remotes for 'git remote update'”
  1. git-completion: offer remotes for 'git remote update'Auke Schrijnen, Sep 25, 2011
  2. Junio C HamanoSep 28, 2011
  3. Auke SchrijnenSep 28, 2011
  4. git-completion: offer remotes for 'git remote update'Auke Schrijnen, Sep 28, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.