zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Fix a bug in _git's clone completion
@ 2008-08-28 16:01 Frank Terbeck
  2008-08-28 18:04 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2008-08-28 16:01 UTC (permalink / raw)
  To: zsh workers

There was a backslash missing at a line end, which screwed up things.

Also, I don't understand the completion after 'git clone --bare <tab>'.
It does not give me *any* completions, while I would expect the same
completions as without the --bare option.

If I do 'git clone --bare -<tab>', I only get a small subset of the
remaining options. I don't know what is happening here.

Finally, I do not understand why the end of the _arguments call was
done like this:

[snip]
    ':repository:__git_any_repositories' \-
    '*:directory:_directories' && ret=0-
[snap]

...and not just: '*:repository:__git_any_repositories' && ret 0

If someone can explain, please do ahead. :)


Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.89
diff -u -r1.89 _git
--- Completion/Unix/Command/_git	24 Aug 2008 19:48:09 -0000	1.89
+++ Completion/Unix/Command/_git	28 Aug 2008 15:51:53 -0000
@@ -1613,7 +1614,7 @@
   _arguments \
     '--bare[make a bare GIT repository]' \
     '(-l --local)'{-l,--local}'[perform a local cloning of a repository]' \
-    '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]'
+    '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \
     '--reference[reference repository]:repository:_directories' \
     '(-q --quiet)'{-q,--quiet}'[operate quietly]' \
     '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \


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

* Re: PATCH: Fix a bug in _git's clone completion
  2008-08-28 16:01 PATCH: Fix a bug in _git's clone completion Frank Terbeck
@ 2008-08-28 18:04 ` Mikael Magnusson
  2008-08-28 18:37   ` Frank Terbeck
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2008-08-28 18:04 UTC (permalink / raw)
  To: zsh workers

2008/8/28 Frank Terbeck <ft@bewatermyfriend.org>:
> There was a backslash missing at a line end, which screwed up things.
>
> Also, I don't understand the completion after 'git clone --bare <tab>'.
> It does not give me *any* completions, while I would expect the same
> completions as without the --bare option.
>
> If I do 'git clone --bare -<tab>', I only get a small subset of the
> remaining options. I don't know what is happening here.

No idea here...

> Finally, I do not understand why the end of the _arguments call was
> done like this:
>
> [snip]
>    ':repository:__git_any_repositories' \-
>    '*:directory:_directories' && ret=0-
> [snap]
>
> ...and not just: '*:repository:__git_any_repositories' && ret 0
>
> If someone can explain, please do ahead. :)

This is because
SYNOPSIS
           git clone ... <repository> [<directory>]

Ie, you can give an optional argument where to clone to. The * is bogus
though.


diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index d6cda20..4a50b39 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1611,14 +1611,14 @@ _git-clean () {
     '*:file:_files' && ret=0
 }

-# TODO: The --no-checkout is undocumented.
 (( $+functions[_git-clone] )) ||
 _git-clone () {

-  _arguments \
+  _arguments -S \
     '--bare[make a bare GIT repository]' \
+    '--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \
     '(-l --local)'{-l,--local}'[perform a local cloning of a repository]' \
-    '(-s --shared)'{-s,--shared}'[share the objects with the source
repository (warning: see man page)]' \
+    '(-s --shared)'{-s,--shared}'[share the objects with the source
repository (warning: see man page)]' \
     '--reference[reference repository]:repository:_directories' \
     '(-q --quiet)'{-q,--quiet}'[operate quietly]' \
     '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD
after clone is complete]' \
@@ -1628,7 +1628,7 @@ _git-clone () {
     $template_arg \
     '--depth[create a shallow clone, given number of revisions deep]:
:_guard "[[\:digit\:]]##" depth' \
     ':repository:__git_any_repositories' \
-    '*:directory:_directories' && ret=0
+    ':directory:_directories' && ret=0
 }

 (( $+functions[_git-commit] )) ||

-- 
Mikael Magnusson


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

* Re: PATCH: Fix a bug in _git's clone completion
  2008-08-28 18:04 ` Mikael Magnusson
@ 2008-08-28 18:37   ` Frank Terbeck
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Terbeck @ 2008-08-28 18:37 UTC (permalink / raw)
  To: zsh workers

Mikael Magnusson <mikachu@gmail.com>:
> 2008/8/28 Frank Terbeck <ft@bewatermyfriend.org>:
[...]
> > Finally, I do not understand why the end of the _arguments call was
> > done like this:
> >
> > [snip]
> >    ':repository:__git_any_repositories' \-
> >    '*:directory:_directories' && ret=0-
> > [snap]
> >
> > ...and not just: '*:repository:__git_any_repositories' && ret 0
> >
> > If someone can explain, please do ahead. :)
> 
> This is because
> SYNOPSIS
>            git clone ... <repository> [<directory>]
> 
> Ie, you can give an optional argument where to clone to. The * is bogus
> though.

Oops, right.
I could swear the completion did something wrong, but I can't
reproduce it anymore. I guess, I missed one zsh-restart when I was
testing. :-)

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


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

end of thread, other threads:[~2008-08-28 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 16:01 PATCH: Fix a bug in _git's clone completion Frank Terbeck
2008-08-28 18:04 ` Mikael Magnusson
2008-08-28 18:37   ` Frank Terbeck

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