Git development
 help / color / mirror / Atom feed
From: Matthew Hughes <matthewhughes934@gmail.com>
To: git@vger.kernel.org
Subject: Re: Bash completion very slow in large repo
Date: Wed, 19 Aug 2026 21:25:46 +0100	[thread overview]
Message-ID: <aoYQ9CCzPM3qKVfZ@desktop> (raw)
In-Reply-To: <an9iXOqOOvFfyN4A@desktop>

On Fri, Aug 14, 2026 at 07:55:36PM +0100, Matthew Hughes wrote:
> I'm not sure about potential fixes. Hacking around on it the best I could come
> up with was a workaround: add an env var to skip index completion during bash
> completion, so the completion falls back to the default Bash file completion
> (i.e. complete any time), here that is (just for demonstration):

My final workaround (read: filthy hack) was to re-define
`__git_complete_index_file` just after sourcing the completion script like:

    # copy __git_complete_index_file to __orig__git_complete_index_file
    eval "__orig$(declare -f __git_complete_index_file)"

    __git_complete_index_file () {
        # options that require 'git' to inspect all files on disk
        local slow_opts_re="(^|[[:space:]])(--others|--modified|--deleted|--ignored|--killed)($|[[:space:]])"    
        if [[ "$1" =~ $slow_opts_re ]]
        then
            return
        fi

        __orig__git_complete_index_file "$@"
    }

      parent reply	other threads:[~2026-08-19 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 18:55 Bash completion very slow in large repo Matthew Hughes
2026-08-15 14:17 ` D. Ben Knoble
2026-08-15 19:52   ` Matthew Hughes
2026-08-19 20:25 ` Matthew Hughes [this message]

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=aoYQ9CCzPM3qKVfZ@desktop \
    --to=matthewhughes934@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox