Home > Blockchain >  Slow git autocomplete with WSL2 and zsh
Slow git autocomplete with WSL2 and zsh

Time:12-29

I recently switched from git bash on windows to using WSL2 almost exclusively.

The issue I am having is that my tab autocompletes for branches is insanely slow (in the seconds). Other autocomplete are fast, such as autocompleting git commands (git checko[TAB] would autocomplete to checkout without problem).

What can I do to isolate the problem or resolve ( less than 1 second to autocomplete) it?

CodePudding user response:

In order to autocomplete branches, bash has to parse files from the .git/refs directory or .git/packed-refs file, where the branch/tag names are stored.

If your repo is stored on the windows partition, this might be the reason why it's slow, as the windows/linux filesystem interop is known to be slow as of now.

In order to speed up the branch-name autocomplete, you could move the repo to the linux partition. If that's not an option, you could write your own autocomplete script that avoids IO with the windows filesystem.

  • Related