Replace disabling the fsmonitor--daemon by just warning about it

Detection could be better, but it works, and it is only a warning, doesn’t have to be perfect.
This commit is contained in:
LenaWil 2023-05-18 21:58:22 +02:00 committed by GitHub
parent 9eb68e6200
commit 9628f51fb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,8 +49,9 @@ def _intent_to_add_cleared() -> Generator[None, None, None]:
@contextlib.contextmanager
def _unstaged_changes_cleared(patch_dir: str) -> Generator[None, None, None]:
# Work around a bug in fsmonitor daemon by stopping it.
cmd_output('git', 'fsmonitor--daemon', 'stop')
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.')
tree = cmd_output('git', 'write-tree')[1].strip()
diff_cmd = (
'git', 'diff-index', '--ignore-submodules', '--binary',