Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: complete more types of remote repository



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@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author