zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: complete more types of remote repository
@ 2014-11-20 20:40 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2014-11-20 20:40 UTC (permalink / raw)
  To: Zsh Hackers' List

This came about because _git-remote doesn't complete local repositories
as the second argument to "add", which is certainly wrong.

However, completion of repositories looks like it might be a bit
inconsistent: I can see a lot of different cases, most of which don't
handle URLs.  But there's nothing special about "git remote add" that
means URLs can be handled there but not elsewhere --- I guess the
problem is that the manual page for git-remote refers to URL in order to
indicate it's an explicit path to another repository.  Maybe
__git_any_repositories needs updating, too?  (That function's not
appropriate in this case, though, as I don't think you can add a remote
as a pointer to another remote.)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 38bd729..8fcfc15 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -3161,7 +3161,15 @@ _git-remote () {
             '(-m --master)'{-m,--master=}'[set HEAD of remote to point to given master branch]: :__git_branch_names' \
             '--mirror[do not use separate remotes]' \
             ':name:__git_remotes' \
-            ':url:_urls' && ret=0
+            ':repository:->repository' && ret=0
+	  case $state in
+	    (repository)
+            _alternative \
+              'local-repositories::__git_local_repositories' \
+              'remote-repositories::__git_remote_repositories' \
+	      'urls::_urls' && ret=0
+	    ;;
+	  esac
           ;;
         (rename)
           _arguments \

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-20 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 20:40 PATCH: complete more types of remote repository Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).