]> git.ipfire.org Git - thirdparty/git.git/blame - compat/fsmonitor/fsm-settings-darwin.c
Merge branch 'es/add-doc-list-short-form-of-all-in-synopsis'
[thirdparty/git.git] / compat / fsmonitor / fsm-settings-darwin.c
CommitLineData
8bff5ca0 1#include "git-compat-util.h"
a85ad67b 2#include "config.h"
68d68646 3#include "fsmonitor-ll.h"
508c1a57
ED
4#include "fsmonitor-ipc.h"
5#include "fsmonitor-settings.h"
6#include "fsmonitor-path-utils.h"
1e7be10d 7
508c1a57 8 /*
1e7be10d
JH
9 * For the builtin FSMonitor, we create the Unix domain socket for the
10 * IPC in the .git directory. If the working directory is remote,
11 * then the socket will be created on the remote file system. This
12 * can fail if the remote file system does not support UDS file types
13 * (e.g. smbfs to a Windows server) or if the remote kernel does not
14 * allow a non-local process to bind() the socket. (These problems
15 * could be fixed by moving the UDS out of the .git directory and to a
16 * well-known local directory on the client machine, but care should
17 * be taken to ensure that $HOME is actually local and not a managed
18 * file share.)
19 *
508c1a57 20 * FAT32 and NTFS working directories are problematic too.
ddc5dacf
JH
21 *
22 * The builtin FSMonitor uses a Unix domain socket in the .git
23 * directory for IPC. These Windows drive formats do not support
24 * Unix domain sockets, so mark them as incompatible for the daemon.
25 *
1e7be10d 26 */
508c1a57 27static enum fsmonitor_reason check_uds_volume(struct repository *r)
1e7be10d 28{
508c1a57 29 struct fs_info fs;
6beb2688 30 const char *ipc_path = fsmonitor_ipc__get_path(r);
508c1a57
ED
31 struct strbuf path = STRBUF_INIT;
32 strbuf_add(&path, ipc_path, strlen(ipc_path));
1e7be10d 33
508c1a57
ED
34 if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
35 strbuf_release(&path);
1e7be10d
JH
36 return FSMONITOR_REASON_ERROR;
37 }
38
508c1a57 39 strbuf_release(&path);
1e7be10d 40
508c1a57
ED
41 if (fs.is_remote ||
42 !strcmp(fs.typename, "msdos") ||
43 !strcmp(fs.typename, "ntfs")) {
44 free(fs.typename);
ddc5dacf 45 return FSMONITOR_REASON_NOSOCKETS;
508c1a57 46 }
ddc5dacf 47
508c1a57 48 free(fs.typename);
1e7be10d
JH
49 return FSMONITOR_REASON_OK;
50}
a85ad67b 51
8f449768 52enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
a85ad67b 53{
1e7be10d
JH
54 enum fsmonitor_reason reason;
55
8f449768
ED
56 if (ipc) {
57 reason = check_uds_volume(r);
58 if (reason != FSMONITOR_REASON_OK)
59 return reason;
60 }
1e7be10d 61
a85ad67b
JH
62 return FSMONITOR_REASON_OK;
63}