zsh-workers
 help / color / mirror / code / Atom feed
From: "Mikael Magnusson" <mikachu@gmail.com>
To: zsh-workers@sunsite.dk
Subject: Re: git completion horribly slow in kernel tree
Date: Thu, 24 Jan 2008 07:46:12 +0100	[thread overview]
Message-ID: <237967ef0801232246n1f6c02ffv4083ce2323b36e0e@mail.gmail.com> (raw)
In-Reply-To: <20080123164835.GA32341@scowler.net>

On 23/01/2008, Clint Adams <clint@zsh.org> wrote:
> On Wed, Jan 23, 2008 at 05:30:05PM +0100, Mikael Magnusson wrote:
> > Hm, I don't really know... git ls-tree seems to not want to output ..,
> > if you specify --full-name, it does show the dir you specify, but
> > relative to the root of the project. So if you're in proj/dir1/dir2
> > and git ls-tree --full-name --name-only HEAD .., you will get files
> > shown as dir1/file1. I guess it's possible to use that output, but
> > maybe it's easier to just manually cd to the proj/ dir first :). I
> > just looked at the bash completer (which is very confusing code), and
> > it seems to use something like
> > git --git-dir=$(git rev-parse --git-dir) ls-tree $ref:prefix
> > which lists the file as file1 instead of dir1/file1. (no idea why it
> > doesn't use --name-only).
>
> I just looked and git-add completion is using ls-files, which can't
> handle relative paths either.

Hm, this "works", but it definitely isn't nice, and doesn't work when
you type the shorter path manually first.
# Untracked files:
#	Src/Modules/curses_keys.h
if i'm sitting in Src/Builtins, the following code will produce
git add <tab>
git add ../<tab>
git add ../../<tab>
git add ../../Src/Modules<tab>
git add ../../Src/Modules/curses_keys.h
which is not so great.
Annoyingly, when i'm sitting in Src/Builtins, git status produces the following
# Untracked files:
#	../Modules/curses_keys.h

I don't know how often one really wants to git add files above the
current dir, but it just annoys me that it's so hard to fix. :)

(( $+functions[__git_files] )) ||
__git_files () {
  local expl files ls_opts opts gitdir cdup

  zparseopts -D -E -a opts -- -cached -deleted -modified -others
-ignored -unmerged -killed

  gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
  __git_command_successful || return

  ls_opts=("--exclude-per-directory=.gitignore")
  [[ -f "$gitdir/info/exclude" ]] &&
ls_opts+="--exclude-from=$gitdir/info/exclude"

  cdup=$(_call_program revparse git rev-parse --show-cdup)
  files=(${(ps:\0:)"$(_call_program files git ls-files --full-name -z
$ls_opts $opts $cdup 2>/dev/null)"})
  files=$cdup${^files}
  __git_command_successful || return

  _wanted files expl 'index file' _multi_parts $@ - / files
}


-- 
Mikael Magnusson


  parent reply	other threads:[~2008-01-24  6:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14 20:17 Jörg Sommer
2008-01-14 21:39 ` Mikael Magnusson
2008-01-22  1:19   ` Clint Adams
2008-01-22  1:40     ` Mikael Magnusson
2008-01-22 16:22       ` Clint Adams
2008-01-22 17:04         ` Clint Adams
2008-01-22 21:04           ` Nikolai Weibull
2008-01-22 21:16             ` Mikael Magnusson
2008-01-22 17:12         ` Clint Adams
2008-01-23 11:20           ` Mikael Magnusson
2008-01-23 13:29             ` Clint Adams
2008-01-23 16:30               ` Mikael Magnusson
2008-01-23 16:48                 ` Clint Adams
2008-01-23 17:03                   ` Mikael Magnusson
2008-01-24  6:46                   ` Mikael Magnusson [this message]
2008-01-24  7:20                     ` Mikael Magnusson

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=237967ef0801232246n1f6c02ffv4083ce2323b36e0e@mail.gmail.com \
    --to=mikachu@gmail.com \
    --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).