mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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 <edecosta@mathworks.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
12fd27df79
commit
25c2cab08f
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user