git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] completion: avoid ls-remote in certain scenarios
Date: Sat, 1 Jun 2013 08:58:28 -0500	[thread overview]
Message-ID: <CAMP44s3abuEuXdRsAkuCVZiBkaFc+pT3kfXK9uN-U7tc4CR3tA@mail.gmail.com> (raw)
In-Reply-To: <20130529074408.GA7955@goldbirke>

On Wed, May 29, 2013 at 2:44 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> On Tue, May 28, 2013 at 10:20:48PM -0500, Felipe Contreras wrote:
>> It's _very_ slow in many cases, and there's really no point in fetching
>> *everything* from the remote just for completion. In many cases it might
>> be faster for the user to type the whole thing.
>>
>> If the user manually specifies 'refs/*', then the full ls-remote
>> completion is triggered.
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  contrib/completion/git-completion.bash | 10 ++--------
>>  1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index 1c35eef..2ce4f7d 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -427,14 +427,8 @@ __git_refs ()
>>               done
>>               ;;
>>       *)
>> -             git ls-remote "$dir" HEAD ORIG_HEAD 'refs/tags/*' 'refs/heads/*' 'refs/remotes/*' 2>/dev/null | \
>> -             while read -r hash i; do
>> -                     case "$i" in
>> -                     *^{}) ;;
>> -                     refs/*) echo "${i#refs/*/}" ;;
>> -                     *) echo "$i" ;;
>> -                     esac
>> -             done
>> +             echo "HEAD"
>> +             git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##"
>
> This case statement is only executed when $dir is not a git directory,
> so what ensures that the cwd is in a git repo or work tree when
> executing this brach of the case statement?  What about 'git
> --git-dir=/path/to/repo' invocations or when $GIT_DIR is specified?

'git --git-dir=foo fetch <tab>' doesn't even work. I sent the patches
to fix it, but as usual, nobody cared about actual real fixes.

$GIT_DIR works fine, why wouldn't it?

-- 
Felipe Contreras

  reply	other threads:[~2013-06-01 13:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29  3:20 [PATCH] completion: avoid ls-remote in certain scenarios Felipe Contreras
2013-05-29  7:44 ` SZEDER Gábor
2013-06-01 13:58   ` Felipe Contreras [this message]
2013-06-01 18:25 ` Ramkumar Ramachandra
2013-06-02 22:08 ` Junio C Hamano
2013-06-02 22:57   ` Felipe Contreras

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAMP44s3abuEuXdRsAkuCVZiBkaFc+pT3kfXK9uN-U7tc4CR3tA@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder@ira.uka.de \
    /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://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).