Closed cfiske closed 3 years ago
It's not fswatch
's interaction, it's actually your shell, because of how you set up your prompt. You're interacting with git to get the information that's shown in the prompt, such as branch name and status.
I get why the .git/
events show up. The problem is that --exclude
is not working correctly, because when I exclude that one path it stops working for everything else outside that path too. Even using another shell which does not have the prompt/git interaction it still does not work.
MacOS Catalina 10.15.7 fswatch 1.15.0 (installed via Homebrew) zsh 5.7.1
Sorry if this is long, but it's a complex and confusing issue to me and I want to be specific.
TL;DR: using
--exclude=.git/
results in no file changes being reported at all anywhere in the specified pathSo I'm trying to use
fswatch
to automatically kick off tests whenever a file changes in my source code folder (which is a git repo). I useohmyzsh
which executesgit_prompt_info
as part of displaying the prompt, to indicate any git status changes. When it runs it creates/removes.git/index.lock
and that is (correctly) reported byfswatch
.Obviously I don't want to run a test every time a prompt is displayed, and really I don't care about anything in the git repo anyway, just my source files.
If I do this:
I get events every time there is a prompt:
If I exclude
.git/index.lock
I get the expected behavior, which is that real changes are reported and prompts are not. However if I exclude all of.git/
I get nothing at all, no matter what I do to any other files outside of.git/
. Most bizarrely of all, even if I start a bare/bin/sh
shell withoutgit_prompt_info
running I still get nothing at all if I have excluded.git/
. I have tried all sorts of combinations of options, and it is specifically this that causes the issue..git/
works as expected (but is not the behavior I need)..git/index.lock
works as expected (but is also not fully the behavior I need).Is there some special
fswatch
interaction with.git/
which is obstructed by excluding it?