zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: partly rewriting alias handling in _git
@ 2008-09-01 18:06 Frank Terbeck
  2008-09-01 18:17 ` Frank Terbeck
  2008-09-01 19:22 ` Clint Adams
  0 siblings, 2 replies; 4+ messages in thread
From: Frank Terbeck @ 2008-09-01 18:06 UTC (permalink / raw)
  To: zsh workers

While the last patch (zw25561) in that field did improve the handling
of git aliases, it also drew my attention to other problems in the
code.

I've been playing with this version for some time and AFAICS it
handles most cases quite well (a lot better than the old one).

Another thing, I didn't address in this patch is this:
    % git c  --some args
           ^- place the cursor here and hit <tab>.

That does not return completions like 'commit'.

If, later in the code (at the end before the last 'case'), you
replace "'*::options:->options' && ret=0" with
        "'*:options:->options' && ret=0", it starts to work.

I'm not sure if I am missing something and the two-colon form was used
on purpose.

Anyway, as for git alias handling:

Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.95
diff -u -r1.95 _git
--- Completion/Unix/Command/_git	31 Aug 2008 16:09:08 -0000	1.95
+++ Completion/Unix/Command/_git	1 Sep 2008 18:02:55 -0000
@@ -4285,16 +4285,16 @@
 IFS=$oifs ; unset oifs
 
 if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then
-  local -a tmpwords
-  tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]})
-  if [[ -z "${words[3,-1]}" ]] ; then
-      tmpwords[$(( ${#tmpwords} + 1 ))]=""
-  else
+  local -a tmpwords expalias
+  expalias=(${(z)git_aliases[$words[2]]})
+  tmpwords=(${words[1]} ${expalias})
+  if [[ -n "${words[3,-1]}" ]] ; then
       tmpwords+=(${words[3,-1]})
   fi
+  tmpwords+=('')
+  (( CURRENT += ${#expalias} - 1 ))
   words=("${tmpwords[@]}")
-  (( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 ))
-  unset tmpwords
+  unset tmpwords expalias
 fi
 
 if [[ $service == git ]]; then


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

end of thread, other threads:[~2008-09-01 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-01 18:06 PATCH: partly rewriting alias handling in _git Frank Terbeck
2008-09-01 18:17 ` Frank Terbeck
2008-09-01 19:22 ` Clint Adams
2008-09-01 20:03   ` 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).