zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: partly rewriting alias handling in _git
Date: Mon, 01 Sep 2008 20:06:42 +0200	[thread overview]
Message-ID: <20080901180642.GE6330@fsst.voodoo.lan> (raw)

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


             reply	other threads:[~2008-09-01 18:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-01 18:06 Frank Terbeck [this message]
2008-09-01 18:17 ` Frank Terbeck
2008-09-01 19:22 ` Clint Adams
2008-09-01 20:03   ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080901180642.GE6330@fsst.voodoo.lan \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).