efox29
efox29

Reputation: 141

Slow git autocomplete with WSL2 and zsh

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?

Upvotes: 0

Views: 3714

Answers (2)

AndyWatts
AndyWatts

Reputation: 345

git config --global oh-my-zsh.hide-info 1

Disable oh-my-zsh git prompt magic.

Root cause is WSL using the slow 9P protocol to access Windows drive.
ref. https://stackoverflow.com/a/68974497/135962

Upvotes: 0

user1855328
user1855328

Reputation: 61

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.

Upvotes: 1

Related Questions