Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yadm add auto-complete slow on zsh 5.8 with compinit loaded and enabled #355

Open
D-Vaillant opened this issue Jul 10, 2021 · 12 comments
Open
Labels

Comments

@D-Vaillant
Copy link

Describe the bug

In general, when I try to tab-autocomplete filenames when using yadm, it lags exceptionally bad to the point where I sometimes have to CTRL-C to do something different. I generally end up killing __git_files, __multi_parts, of __git_command_succesful.

This does not occur with other command tab-completes that I've observed.

To reproduce

Can this be reproduced with the yadm/testbed docker image: Unsure

Steps to reproduce the behavior:

  1. Have the following in your .zshrc: autoload -U compinit; compinit.
  2. Enter yadm add ~/.z, hit Tab. (Or try other completes.)
  3. This will eventually resolve, but after a while.

Expected behavior

Tab auto-completes take a normal amount of time, on the order of milliseconds and not seconds.

Environment

  • Operating system: 5.4.124-1-MANJARO
  • Version yadm: 3.0.2
  • Version Git: 2.32.0
  • Version zsh: 5.8
@D-Vaillant D-Vaillant added the bug label Jul 10, 2021
@TheLocehiliosan
Copy link
Member

@D-Vaillant - What's the output of yadm gitconfig --get status.showUntrackedFiles for you?

@D-Vaillant
Copy link
Author

D-Vaillant commented Dec 6, 2021

~ >>> yadm gitconfig --get status.showUntrackedFiles
no

Environment

Operating system: 5.10.82-1-MANJARO
Version yadm: 3.0.2
Version Git: 2.34.1
Version zsh: 5.8

@D-Vaillant
Copy link
Author

Oh, important additional information: it only happens when I'm in my home directory. If I'm in a smaller sub-directory it works as expected.

I've reproduced it using just pure git so this is probably a zsh compinit issue and not a yadm issue.

@cmer
Copy link

cmer commented Dec 19, 2021

I have the same issue, but I am using Fish. After I press "tab", it never completes. My fish process pegs the CPU at 100%. I have to CTRL-C to regain access to my shell.

@rotech
Copy link

rotech commented Jan 7, 2022

I'm seeing this too in fish, and I think it is caused by an interaction with the built-in git completions.

The line complete -c yadm -w "git --git-dir=$GIT_DIR" at the bottom of yadm.fish hooks into the standard git completions when you are using the git commands (like add). The git completion shipped with fish helpfully scans files to tell you if they are untracked or not, but in this case scans your whole home directory, so it takes ages.

I have tried experimenting with something like the line below to try and work around it, but I can't seem to get it working. Anyone have any ideas?

complete -c yadm -n "not __fish_yadm_using_command add" -w "git --git-dir=$GIT_DIR"

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Mar 8, 2022
@TheLocehiliosan TheLocehiliosan added 3 and removed stale labels Mar 12, 2022
@rvalieris
Copy link

same issue here, I found that overriding __git_files with this function solves the problem for me:

__git_files () { 
    _wanted files expl 'local files' _files     
}

thats for zsh, idk about fish but its probably a similar solution, the original function is shipped by zsh
source: https://stackoverflow.com/a/9810485

@xenoterracide
Copy link

xenoterracide commented Mar 16, 2022

Another possibility would be for yadm to ship with a sensible ~/.gitignore out of the box. Here's mine, outside of the already tracked excludes anyone should be able to use and edit this without issue. Feel free to PR or check the source in case I update it https://github.com/xenoterracide/dotfiles/blob/master/.gitignore

yadm status -u will tell you all of the massive garbage that yadm add <tab> is trying to autocomplete

## already tracked
.zshrc
.zshenv
.gitconfig

## compiled dynamic langauages
*.pyc
*.zwc

*.log

*.idea
*.iml
*.code-workspace

# You may want to customise this file depending on your Operating System
# and the editor that you use.
#
# We recommend that you use a Global Gitignore for files that are not related
# to the project. (https://help.github.com/articles/ignoring-files/#create-a-global-gitignore)

# OS
#
# Ref: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Ref: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# Ref: https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# Archives
# https://github.com/github/gitignore/blob/master/Global/Archives.gitignore
# It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
*.zip
*.gz
*.gzip
*.tgz
*.bzip
*.bzip2
*.bz2
*.xz
*.lzma
*.cab
*.xar
*.zst

# Packing-only formats
*.iso
*.tar

# Package management formats
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
*.msi
*.msm
*.msp
*.txz

# Editors
#
# Ref: https://github.com/github/gitignore/blob/master/Global
# Ref: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
# Ref: https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
.idea

*.swp

# Homedir
Videos/
Pictures/
Downloads/
IdeaProjects/
Templates/
Dropbox/
Desktop/
Documents/
.cache/
caches/
.zoom/
.zi/
.vscode-oss/
.vim/
.thunderbird/
.sylpheed-2.0/
.steam*
.ssh/
.pki/
.pkg-cache/
.spamassassin/
.phoronix-test-suite/
.parallel/
.nvm/
.npm/
.node/
.mozilla/
.minikube/
.m2/repository/
*history*
.local/
.kde4/
.jdks/
.java/
.hyper_plugins/
.gradle/
.gnupg/
.electron-gyp/
.dropbox*/
.claws-mail/
.cargo/
.asdf/
.adobe-reader*/

## .config abusers
.config/opera/
.config/evolution/
.config/discord/
.config/hexchat/
.config/zconvey/
.config/pulse/
.config/gtk-*/
.config/ranger/
.config/ibus/
.config/chromium/
.config/akonadi/
.config/Slack/
.config/Signal/
.config/Microsoft/
.config/JetBrains/
.config/Hyper/
.config/FontBase/
.config/Code - OSS/
.config/Bitwarden/

@arc-onizuka
Copy link

Could someone look into this? It's not really a stopper but kind of makes me feel dirty :D

@januz
Copy link

januz commented May 9, 2023

I'm also running into this problem using fish. @TheLocehiliosan Is there a recommended way how to handle this problem? Thanks!

@cmer
Copy link

cmer commented May 9, 2023

Great tip, @xenoterracide. I solved my issue with what you said. Here's my .gitignore, for the record.

# MacOS
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Ref: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# Ref: https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# Archives
# https://github.com/github/gitignore/blob/master/Global/Archives.gitignore
# It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
*.zip
*.gz
*.gzip
*.tgz
*.bzip
*.bzip2
*.bz2
*.xz
*.lzma
*.cab
*.xar
*.zst

# Packing-only formats
*.iso
*.tar

# Package management formats
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
*.msi
*.msm
*.msp
*.txz

###Tags###

# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
TAGS
!TAGS/
tags
!tags/
gtags.files
GTAGS
GRTAGS
GPATH
cscope.files
cscope.out
cscope.in.out
cscope.po.out

# Other stuff
lnav
*.log
*.idea
*.iml
*.code-workspace
*.swp

## compiled dynamic langauages
*.pyc
*.zwc

## YADM ignores to speed up autocompletion
.asdf/installs
.asdf/shims
.asdf/plugins
.asdf/tmp
.bundle/cache
.cache
.cargo
.colima/_wrapper
.npm
.platformio
.vscode/extensions
Library
Downloads
Pictures
golang

@xenoterracide
Copy link

wow, why has mine gotten so bad again :/ would be nice if this wasn't .gitignore and instead .yadmignore so my global git config for dev repos isn't impacted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants