git-worktree-switcher icon indicating copy to clipboard operation
git-worktree-switcher copied to clipboard

Fail silently when listing, if the user is not in a git repo

Open mateusauler opened this issue 1 year ago • 2 comments

Adds a check for if the current directory is part of a git repository.

This is to prevent a loud failure when trying to build auto-completion options.

Eg. in fish, when typing wt and trying to auto-complete outside a git repo, stderr would get polluted with git complaining and completion would stop working for the rest of the shell session duration.

mateusauler avatar Apr 21 '24 02:04 mateusauler

@mateusauler thank you for the PR, can you post an image of failure you're referring to.

yankeexe avatar Apr 25 '24 03:04 yankeexe

Of course! Here it is: image

Also, after some testing, fish stops completing even when the completion script does not fail and simply outputs nothing. I'll investigate further and open another PR if I can fix it.

mateusauler avatar Apr 25 '24 12:04 mateusauler