diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2022-05-27 00:46:58 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-27 01:59:26 +0300 |
commit | 62a62a28308453ee830bb7e02cf732474a6e01a5 (patch) | |
tree | bb7a65a5e3e244b804a4089cb984d506b3e2736a /builtin/fsmonitor--daemon.c | |
parent | 49b398a970f6efa368114330da23ae69aeeb9c60 (diff) |
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 <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsmonitor--daemon.c')
-rw-r--r-- | builtin/fsmonitor--daemon.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index 46be55a461..66b78a0353 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1423,6 +1423,7 @@ static int try_to_start_background_daemon(void) int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix) { const char *subcmd; + enum fsmonitor_reason reason; int detach_console = 0; struct option options[] = { @@ -1449,6 +1450,23 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix) die(_("invalid 'ipc-threads' value (%d)"), fsmonitor__ipc_threads); + prepare_repo_settings(the_repository); + /* + * If the repo is fsmonitor-compatible, explicitly set IPC-mode + * (without bothering to load the `core.fsmonitor` config settings). + * + * If the repo is not compatible, the repo-settings will be set to + * incompatible rather than IPC, so we can use one of the __get + * routines to detect the discrepancy. + */ + fsm_settings__set_ipc(the_repository); + + reason = fsm_settings__get_reason(the_repository); + if (reason > FSMONITOR_REASON_OK) + die("%s", + fsm_settings__get_incompatible_msg(the_repository, + reason)); + if (!strcmp(subcmd, "start")) return !!try_to_start_background_daemon(); |