From 62a62a28308453ee830bb7e02cf732474a6e01a5 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Thu, 26 May 2022 21:46:58 +0000 Subject: fsmonitor-settings: bare repos are incompatible with FSMonitor Bare repos do not have a worktree, so there is nothing for the daemon watch. Signed-off-by: Jeff Hostetler Signed-off-by: Junio C Hamano --- builtin/update-index.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'builtin/update-index.c') diff --git a/builtin/update-index.c b/builtin/update-index.c index 876112abb2..01ed4c4976 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1237,6 +1237,22 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) if (fsmonitor > 0) { enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r); + enum fsmonitor_reason reason = fsm_settings__get_reason(r); + + /* + * The user wants to turn on FSMonitor using the command + * line argument. (We don't know (or care) whether that + * is the IPC or HOOK version.) + * + * Use one of the __get routines to force load the FSMonitor + * config settings into the repo-settings. That will detect + * whether the file system is compatible so that we can stop + * here with a nice error message. + */ + if (reason > FSMONITOR_REASON_OK) + die("%s", + fsm_settings__get_incompatible_msg(r, reason)); + if (fsm_mode == FSMONITOR_MODE_DISABLED) { warning(_("core.fsmonitor is unset; " "set it if you really want to " -- cgit v1.2.3