Skip to content

Git Tab Completion Slow on Larger repositories for certain commands #1533

@nwhansen

Description

@nwhansen
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
64 bit installer
git version 2.16.1.windows.4
cpu: x86_64
built from commit: ef6d451bbfef86a529ebf12620289e0f15a93d8e
sizeof-long: 4

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
    Windows 10
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
  • What options did you set as part of the installation? Or did you choose the
    defaults?
Editor Option: VIM
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

This repository is very large. 5gb in size however this is replicatable with linux kernal repository. I am not using a solid state for the repository.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Git Bash

git status -- ar[TAB]

Or

git mv ar[TAB]
  • What did you expect to occur after running these commands?
    Tab completed to
git status -- arch/
  • What actually happened instead?
    After approximately 10-20 seconds it completes

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?
    Reproduced using: https://github.com/torvalds/linux


h3. Additional investigation:
Enabling

GIT_TRACE_PERFORMANCE=<logfile>

Creates the following log entries

13:59:59.608590 trace.c:417             performance: 0.002119112 s: git command: 'C:\Program Files\Git\mingw64\bin\git.exe' 'rev-parse' '--git-dir' '--is-inside-git-dir' '--is-bare-repository' '--is-inside-work-tree' '--short' 'HEAD'
14:00:16.755165 trace.c:417             performance: 0.001872594 s: git command: 'C:\Program Files\Git\mingw64\bin\git.exe' 'config' 'status.showUntrackedFiles'
14:00:28.706112 trace.c:417             performance: 11.796146578 s: git command: 'C:\Program Files\Git\mingw64\bin\git.exe' '-C' '.' 'ls-files' '--exclude-standard' '--cached' '--directory' '--no-empty-directory' '--others'

Running the command

"C:\Program Files\Git\mingw64\bin\git.exe" -C ./ ls-files --exclude-standard --cached --directory --no-empty-directory --others

Returns 62913 lines. Attached as ls-files-result.txt
ls-files-result.txt

Git status on freshly checkout respository is the file checkoutStatus.txt
checkoutStatus.txt

Some further investigation shows that running set -x to gain some insight into the completion script shows that we spend a lot of time opening the completion script with

++case "$file" in
++echo drivers
++read -r file

being repeated what seems thousands of times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions