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
Warn if the fsmonitor-daemon is running #2891
base: main
Are you sure you want to change the base?
Conversation
Detection could be better, but it works, and it is only a warning, doesn’t have to be perfect.
for more information, see https://pre-commit.ci
pre_commit/staged_files_only.py
Outdated
if cmd_output('git', 'fsmonitor--daemon', 'status')[1].startswith('fsmonitor-daemon is watching'): | ||
logger.warning('The fsmonitor-daemon is running; a bug in the fsmonitor-daemon sometimes causes data loss when run with pre-commit.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break on old versions of git
this will also add this subprocess overhead to every execution -- ~20ms on my machine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break on old versions of git
Good point, switched it to checking for the return code.
this will also add this subprocess overhead to every execution -- ~20ms on my machine
I added two extra checks, a platform check, since it’s only available on Windows & macOS, and a check for the ipc file that should by default be there, although it’s seems to be possible to change it on macOS. Does this speed it up enough?
@asottile Is this okay? Do I need to write tests? |
Less extreme than #2890.