* PATCH: _git log arguments
@ 2007-09-30 19:40 Clint Adams
2007-10-01 7:16 ` Nikolai Weibull
0 siblings, 1 reply; 6+ messages in thread
From: Clint Adams @ 2007-09-30 19:40 UTC (permalink / raw)
To: zsh-workers
I tried this with various things that called git-ls-files but
they were insanely slow.
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.35
diff -u -r1.35 _git
--- Completion/Unix/Command/_git 30 Sep 2007 19:23:14 -0000 1.35
+++ Completion/Unix/Command/_git 30 Sep 2007 19:38:38 -0000
@@ -1705,7 +1705,8 @@
__git_setup_revision_arguments
_arguments -S \
- $revision_arguments && ret=0
+ "$revision_arguments[@]" \
+ '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0
}
# TODO: repository needs fixing
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: _git log arguments
2007-09-30 19:40 PATCH: _git log arguments Clint Adams
@ 2007-10-01 7:16 ` Nikolai Weibull
2007-10-01 13:36 ` Clint Adams
0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-01 7:16 UTC (permalink / raw)
To: zsh-workers
On 9/30/07, Clint Adams <clint@zsh.org> wrote:
> I tried this with various things that called git-ls-files but
> they were insanely slow.
> - $revision_arguments && ret=0
> + "$revision_arguments[@]" \
Why use "$revision_arguments[@]"? $revision_arguments works just as
good and you don't need all the quoting and expansion fluff. I see
this style has been used for $merge_args as well, even though most of
the file doesn't.
> + '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0
I don't like this at all. Why not simply use __git_cached_files? And
if we really need __git_committishs, let's at least use a separate
function for that with proper descriptions and tags.
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.33
diff -u -r1.33 _git
--- Completion/Unix/Command/_git 30 Sep 2007 18:18:18 -0000 1.33
+++ Completion/Unix/Command/_git 1 Oct 2007 07:15:31 -0000
@@ -1711,7 +1711,8 @@
__git_setup_revision_arguments
_arguments -S \
- $revision_arguments && ret=0
+ $revision_arguments \
+ '*:file:__git_cached_files' && ret=0
}
# TODO: repository needs fixing
nikolai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: _git log arguments
2007-10-01 7:16 ` Nikolai Weibull
@ 2007-10-01 13:36 ` Clint Adams
2007-10-01 13:56 ` Nikolai Weibull
0 siblings, 1 reply; 6+ messages in thread
From: Clint Adams @ 2007-10-01 13:36 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: zsh-workers
On Mon, Oct 01, 2007 at 09:16:54AM +0200, Nikolai Weibull wrote:
> Why use "$revision_arguments[@]"? $revision_arguments works just as
> good and you don't need all the quoting and expansion fluff. I see
> this style has been used for $merge_args as well, even though most of
> the file doesn't.
I seem to recall it being necessary for $merge_args, though I don't
recall the specifics.
> > + '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0
>
> I don't like this at all. Why not simply use __git_cached_files? And
> if we really need __git_committishs, let's at least use a separate
> function for that with proper descriptions and tags.
Your patch reworked against HEAD is below. Now how do we accommodate
the people that want to have a branch name completed after git log?
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.36
diff -u -r1.36 _git
--- Completion/Unix/Command/_git 30 Sep 2007 19:41:57 -0000 1.36
+++ Completion/Unix/Command/_git 1 Oct 2007 13:33:46 -0000
@@ -1705,8 +1705,8 @@
__git_setup_revision_arguments
_arguments -S \
- "$revision_arguments[@]" \
- '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0
+ $revision_arguments \
+ '*:file:__git_cached_files' && ret=0
}
# TODO: repository needs fixing
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: _git log arguments
2007-10-01 13:36 ` Clint Adams
@ 2007-10-01 13:56 ` Nikolai Weibull
2007-10-01 19:37 ` Clint Adams
0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-01 13:56 UTC (permalink / raw)
To: zsh-workers
On 10/1/07, Clint Adams <clint@zsh.org> wrote:
> On Mon, Oct 01, 2007 at 09:16:54AM +0200, Nikolai Weibull wrote:
> > Why use "$revision_arguments[@]"? $revision_arguments works just as
> > good and you don't need all the quoting and expansion fluff. I see
> > this style has been used for $merge_args as well, even though most of
> > the file doesn't.
>
> I seem to recall it being necessary for $merge_args, though I don't
> recall the specifics.
>
> > > + '*:tree-ish: _alternative c\:\:__git_committishs f\:\:_files' && ret=0
> >
> > I don't like this at all. Why not simply use __git_cached_files? And
> > if we really need __git_committishs, let's at least use a separate
> > function for that with proper descriptions and tags.
>
> Your patch reworked against HEAD is below. Now how do we accommodate
> the people that want to have a branch name completed after git log?
This should really be context sensitive, that is, what to complete
here is dependent on what arguments we've seen already.
Here's a patch that will suffice for the time being:
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.37
diff -u -r1.37 _git
--- Completion/Unix/Command/_git 1 Oct 2007 13:37:31 -0000 1.37
+++ Completion/Unix/Command/_git 1 Oct 2007 13:55:53 -0000
@@ -1702,11 +1702,22 @@
(( $+functions[_git-log] )) ||
_git-log () {
+ local curcontext=$curcontext state line
+ declare -A opt_args
+
__git_setup_revision_arguments
_arguments -S \
$revision_arguments \
- '*:file:__git_cached_files' && ret=0
+ '*:file-or-branch:->files' && ret=0
+
+ case $state in
+ (files)
+ _alternative \
+ 'files:index file:__git_cached_files' \
+ 'branches:branch:__git_branch_names' && ret=0
+ ;;
+ esac
}
# TODO: repository needs fixing
nikolai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: _git log arguments
2007-10-01 13:56 ` Nikolai Weibull
@ 2007-10-01 19:37 ` Clint Adams
2007-10-01 22:02 ` Nikolai Weibull
0 siblings, 1 reply; 6+ messages in thread
From: Clint Adams @ 2007-10-01 19:37 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: zsh-workers
On Mon, Oct 01, 2007 at 03:56:43PM +0200, Nikolai Weibull wrote:
> This should really be context sensitive, that is, what to complete
> here is dependent on what arguments we've seen already.
>
> Here's a patch that will suffice for the time being:
Committed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: _git log arguments
2007-10-01 19:37 ` Clint Adams
@ 2007-10-01 22:02 ` Nikolai Weibull
0 siblings, 0 replies; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-01 22:02 UTC (permalink / raw)
To: Nikolai Weibull, zsh-workers
On 10/1/07, Clint Adams <clint@zsh.org> wrote:
> On Mon, Oct 01, 2007 at 03:56:43PM +0200, Nikolai Weibull wrote:
> > This should really be context sensitive, that is, what to complete
> > here is dependent on what arguments we've seen already.
> > Here's a patch that will suffice for the time being:
> Committed.
Thanks.
nikolai
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-01 22:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-30 19:40 PATCH: _git log arguments Clint Adams
2007-10-01 7:16 ` Nikolai Weibull
2007-10-01 13:36 ` Clint Adams
2007-10-01 13:56 ` Nikolai Weibull
2007-10-01 19:37 ` Clint Adams
2007-10-01 22:02 ` Nikolai Weibull
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).