From 25c2cab08f90b6251b1ace91e37f05d4cb8fcd0c Mon Sep 17 00:00:00 2001 From: Eric DeCosta Date: Tue, 4 Oct 2022 17:32:30 +0000 Subject: fsmonitor: check for compatability before communicating with fsmonitor If fsmonitor is not in a compatible state, warn with an appropriate message. Signed-off-by: Eric DeCosta Signed-off-by: Junio C Hamano --- fsmonitor-settings.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fsmonitor-settings.c') diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c index 531a1b6f95..ee63a97dc5 100644 --- a/fsmonitor-settings.c +++ b/fsmonitor-settings.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "repository.h" +#include "fsmonitor-ipc.h" #include "fsmonitor-settings.h" #include "fsmonitor-path-utils.h" @@ -242,10 +243,11 @@ enum fsmonitor_reason fsm_settings__get_reason(struct repository *r) return r->settings.fsmonitor->reason; } -char *fsm_settings__get_incompatible_msg(const struct repository *r, +char *fsm_settings__get_incompatible_msg(struct repository *r, enum fsmonitor_reason reason) { struct strbuf msg = STRBUF_INIT; + const char *socket_dir; switch (reason) { case FSMONITOR_REASON_UNTESTED: @@ -281,9 +283,11 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r, goto done; case FSMONITOR_REASON_NOSOCKETS: + socket_dir = dirname((char *)fsmonitor_ipc__get_path(r)); strbuf_addf(&msg, - _("repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"), - r->worktree); + _("socket directory '%s' is incompatible with fsmonitor due" + " to lack of Unix sockets support"), + socket_dir); goto done; } -- cgit v1.2.3