git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Eric DeCosta via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Jeff Hostetler" <git@jeffhostetler.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Torsten Bögershausen" <tboegi@web.de>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Ramsay Jones" <ramsay@ramsayjones.plus.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Eric DeCosta" <edecosta@mathworks.com>,
	"Eric DeCosta" <edecosta@mathworks.com>
Subject: [PATCH v13 1/6] fsmonitor: refactor filesystem checks to common interface
Date: Tue, 27 Sep 2022 20:57:28 +0000	[thread overview]
Message-ID: <0b9b64428c5e096ada1f274639be9604e8c2f9ed.1664312254.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1326.v13.git.1664312253.gitgitgadget@gmail.com>

From: Eric DeCosta <edecosta@mathworks.com>

Provide a common interface for getting basic filesystem information
including filesystem type and whether the filesystem is remote.

Refactor existing code for getting basic filesystem info and detecting
remote file systems to the new interface.

Refactor filesystem checks to leverage new interface. For macOS,
error-out if the Unix Domain socket (UDS) file is on a remote
filesystem.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
---
 Makefile                                 |   1 +
 compat/fsmonitor/fsm-path-utils-darwin.c |  40 ++++++
 compat/fsmonitor/fsm-path-utils-win32.c  | 128 +++++++++++++++++
 compat/fsmonitor/fsm-settings-darwin.c   |  62 +++-----
 compat/fsmonitor/fsm-settings-win32.c    | 172 +----------------------
 contrib/buildsystems/CMakeLists.txt      |   2 +
 fsmonitor-path-utils.h                   |  23 +++
 fsmonitor-settings.c                     |  50 +++++++
 8 files changed, 263 insertions(+), 215 deletions(-)
 create mode 100644 compat/fsmonitor/fsm-path-utils-darwin.c
 create mode 100644 compat/fsmonitor/fsm-path-utils-win32.c
 create mode 100644 fsmonitor-path-utils.h

diff --git a/Makefile b/Makefile
index cac3452edb9..ffab427ea5b 100644
--- a/Makefile
+++ b/Makefile
@@ -2044,6 +2044,7 @@ endif
 ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
 	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
+	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
 
 ifeq ($(TCLTK_PATH),)
diff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/compat/fsmonitor/fsm-path-utils-darwin.c
new file mode 100644
index 00000000000..067cbe6990a
--- /dev/null
+++ b/compat/fsmonitor/fsm-path-utils-darwin.c
@@ -0,0 +1,40 @@
+#include "fsmonitor.h"
+#include "fsmonitor-path-utils.h"
+#include <sys/param.h>
+#include <sys/mount.h>
+
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
+{
+	struct statfs fs;
+	if (statfs(path, &fs) == -1) {
+		int saved_errno = errno;
+		trace_printf_key(&trace_fsmonitor, "statfs('%s') failed: %s",
+				 path, strerror(saved_errno));
+		errno = saved_errno;
+		return -1;
+	}
+
+	trace_printf_key(&trace_fsmonitor,
+			 "statfs('%s') [type 0x%08x][flags 0x%08x] '%s'",
+			 path, fs.f_type, fs.f_flags, fs.f_fstypename);
+
+	if (!(fs.f_flags & MNT_LOCAL))
+		fs_info->is_remote = 1;
+	else
+		fs_info->is_remote = 0;
+
+	fs_info->typename = fs.f_fstypename;
+
+	trace_printf_key(&trace_fsmonitor,
+				"'%s' is_remote: %d",
+				path, fs_info->is_remote);
+	return 0;
+}
+
+int fsmonitor__is_fs_remote(const char *path)
+{
+	struct fs_info fs;
+	if (fsmonitor__get_fs_info(path, &fs))
+		return -1;
+	return fs.is_remote;
+}
diff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/compat/fsmonitor/fsm-path-utils-win32.c
new file mode 100644
index 00000000000..a90b8f7925b
--- /dev/null
+++ b/compat/fsmonitor/fsm-path-utils-win32.c
@@ -0,0 +1,128 @@
+#include "cache.h"
+#include "fsmonitor.h"
+#include "fsmonitor-path-utils.h"
+
+/*
+ * Check remote working directory protocol.
+ *
+ * Return -1 if client machine cannot get remote protocol information.
+ */
+static int check_remote_protocol(wchar_t *wpath)
+{
+	HANDLE h;
+	FILE_REMOTE_PROTOCOL_INFO proto_info;
+
+	h = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+			FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+	if (h == INVALID_HANDLE_VALUE) {
+		error(_("[GLE %ld] unable to open for read '%ls'"),
+		      GetLastError(), wpath);
+		return -1;
+	}
+
+	if (!GetFileInformationByHandleEx(h, FileRemoteProtocolInfo,
+		&proto_info, sizeof(proto_info))) {
+		error(_("[GLE %ld] unable to get protocol information for '%ls'"),
+		      GetLastError(), wpath);
+		CloseHandle(h);
+		return -1;
+	}
+
+	CloseHandle(h);
+
+	trace_printf_key(&trace_fsmonitor,
+				"check_remote_protocol('%ls') remote protocol %#8.8lx",
+				wpath, proto_info.Protocol);
+
+	return 0;
+}
+
+/*
+ * Notes for testing:
+ *
+ * (a) Windows allows a network share to be mapped to a drive letter.
+ *     (This is the normal method to access it.)
+ *
+ *     $ NET USE Z: \\server\share
+ *     $ git -C Z:/repo status
+ *
+ * (b) Windows allows a network share to be referenced WITHOUT mapping
+ *     it to drive letter.
+ *
+ *     $ NET USE \\server\share\dir
+ *     $ git -C //server/share/repo status
+ *
+ * (c) Windows allows "SUBST" to create a fake drive mapping to an
+ *     arbitrary path (which may be remote)
+ *
+ *     $ SUBST Q: Z:\repo
+ *     $ git -C Q:/ status
+ *
+ * (d) Windows allows a directory symlink to be created on a local
+ *     file system that points to a remote repo.
+ *
+ *     $ mklink /d ./link //server/share/repo
+ *     $ git -C ./link status
+ */
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
+{
+	wchar_t wpath[MAX_PATH];
+	wchar_t wfullpath[MAX_PATH];
+	size_t wlen;
+	UINT driveType;
+
+	/*
+	 * Do everything in wide chars because the drive letter might be
+	 * a multi-byte sequence.  See win32_has_dos_drive_prefix().
+	 */
+	if (xutftowcs_path(wpath, path) < 0) {
+		return -1;
+	}
+
+	/*
+	 * GetDriveTypeW() requires a final slash.  We assume that the
+	 * worktree pathname points to an actual directory.
+	 */
+	wlen = wcslen(wpath);
+	if (wpath[wlen - 1] != L'\\' && wpath[wlen - 1] != L'/') {
+		wpath[wlen++] = L'\\';
+		wpath[wlen] = 0;
+	}
+
+	/*
+	 * Normalize the path.  If nothing else, this converts forward
+	 * slashes to backslashes.  This is essential to get GetDriveTypeW()
+	 * correctly handle some UNC "\\server\share\..." paths.
+	 */
+	if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL)) {
+		return -1;
+	}
+
+	driveType = GetDriveTypeW(wfullpath);
+	trace_printf_key(&trace_fsmonitor,
+			 "DriveType '%s' L'%ls' (%u)",
+			 path, wfullpath, driveType);
+
+	if (driveType == DRIVE_REMOTE) {
+		fs_info->is_remote = 1;
+		if (check_remote_protocol(wfullpath) < 0)
+			return -1;
+	} else {
+		fs_info->is_remote = 0;
+	}
+
+	trace_printf_key(&trace_fsmonitor,
+				"'%s' is_remote: %d",
+				path, fs_info->is_remote);
+
+	return 0;
+}
+
+int fsmonitor__is_fs_remote(const char *path)
+{
+	struct fs_info fs;
+	if (fsmonitor__get_fs_info(path, &fs))
+		return -1;
+	return fs.is_remote;
+}
diff --git a/compat/fsmonitor/fsm-settings-darwin.c b/compat/fsmonitor/fsm-settings-darwin.c
index efc732c0f31..dba3ced6bb7 100644
--- a/compat/fsmonitor/fsm-settings-darwin.c
+++ b/compat/fsmonitor/fsm-settings-darwin.c
@@ -1,32 +1,10 @@
-#include "cache.h"
 #include "config.h"
-#include "repository.h"
-#include "fsmonitor-settings.h"
 #include "fsmonitor.h"
-#include <sys/param.h>
-#include <sys/mount.h>
+#include "fsmonitor-ipc.h"
+#include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
 
-/*
- * [1] Remote working directories are problematic for FSMonitor.
- *
- * The underlying file system on the server machine and/or the remote
- * mount type (NFS, SAMBA, etc.) dictates whether notification events
- * are available at all to remote client machines.
- *
- * Kernel differences between the server and client machines also
- * dictate the how (buffering, frequency, de-dup) the events are
- * delivered to client machine processes.
- *
- * A client machine (such as a laptop) may choose to suspend/resume
- * and it is unclear (without lots of testing) whether the watcher can
- * resync after a resume.  We might be able to treat this as a normal
- * "events were dropped by the kernel" event and do our normal "flush
- * and resync" --or-- we might need to close the existing (zombie?)
- * notification fd and create a new one.
- *
- * In theory, the above issues need to be addressed whether we are
- * using the Hook or IPC API.
- *
+ /*
  * For the builtin FSMonitor, we create the Unix domain socket for the
  * IPC in the .git directory.  If the working directory is remote,
  * then the socket will be created on the remote file system.  This
@@ -38,40 +16,34 @@
  * be taken to ensure that $HOME is actually local and not a managed
  * file share.)
  *
- * So (for now at least), mark remote working directories as
- * incompatible.
- *
- *
- * [2] FAT32 and NTFS working directories are problematic too.
+ * FAT32 and NTFS working directories are problematic too.
  *
  * The builtin FSMonitor uses a Unix domain socket in the .git
  * directory for IPC.  These Windows drive formats do not support
  * Unix domain sockets, so mark them as incompatible for the daemon.
  *
  */
-static enum fsmonitor_reason check_volume(struct repository *r)
+static enum fsmonitor_reason check_uds_volume(struct repository *r)
 {
-	struct statfs fs;
+	struct fs_info fs;
+	const char *ipc_path = fsmonitor_ipc__get_path();
+	struct strbuf path = STRBUF_INIT;
+	strbuf_add(&path, ipc_path, strlen(ipc_path));
 
-	if (statfs(r->worktree, &fs) == -1) {
-		int saved_errno = errno;
-		trace_printf_key(&trace_fsmonitor, "statfs('%s') failed: %s",
-				 r->worktree, strerror(saved_errno));
-		errno = saved_errno;
+	if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
+		strbuf_release(&path);
 		return FSMONITOR_REASON_ERROR;
 	}
 
-	trace_printf_key(&trace_fsmonitor,
-			 "statfs('%s') [type 0x%08x][flags 0x%08x] '%s'",
-			 r->worktree, fs.f_type, fs.f_flags, fs.f_fstypename);
+	strbuf_release(&path);
 
-	if (!(fs.f_flags & MNT_LOCAL))
+	if (fs.is_remote)
 		return FSMONITOR_REASON_REMOTE;
 
-	if (!strcmp(fs.f_fstypename, "msdos")) /* aka FAT32 */
+	if (!strcmp(fs.typename, "msdos")) /* aka FAT32 */
 		return FSMONITOR_REASON_NOSOCKETS;
 
-	if (!strcmp(fs.f_fstypename, "ntfs"))
+	if (!strcmp(fs.typename, "ntfs"))
 		return FSMONITOR_REASON_NOSOCKETS;
 
 	return FSMONITOR_REASON_OK;
@@ -81,7 +53,7 @@ enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
 {
 	enum fsmonitor_reason reason;
 
-	reason = check_volume(r);
+	reason = check_uds_volume(r);
 	if (reason != FSMONITOR_REASON_OK)
 		return reason;
 
diff --git a/compat/fsmonitor/fsm-settings-win32.c b/compat/fsmonitor/fsm-settings-win32.c
index e5ec5b0a9f7..d88b06ae610 100644
--- a/compat/fsmonitor/fsm-settings-win32.c
+++ b/compat/fsmonitor/fsm-settings-win32.c
@@ -1,8 +1,9 @@
 #include "cache.h"
 #include "config.h"
 #include "repository.h"
-#include "fsmonitor-settings.h"
 #include "fsmonitor.h"
+#include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
 
 /*
  * VFS for Git is incompatible with FSMonitor.
@@ -24,171 +25,6 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
 	return FSMONITOR_REASON_OK;
 }
 
-/*
- * Check if monitoring remote working directories is allowed.
- *
- * By default, monitoring remote working directories is
- * disabled.  Users may override this behavior in enviroments where
- * they have proper support.
- */
-static int check_config_allowremote(struct repository *r)
-{
-	int allow;
-
-	if (!repo_config_get_bool(r, "fsmonitor.allowremote", &allow))
-		return allow;
-
-	return -1; /* fsmonitor.allowremote not set */
-}
-
-/*
- * Check remote working directory protocol.
- *
- * Error if client machine cannot get remote protocol information.
- */
-static int check_remote_protocol(wchar_t *wpath)
-{
-	HANDLE h;
-	FILE_REMOTE_PROTOCOL_INFO proto_info;
-
-	h = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
-			FILE_FLAG_BACKUP_SEMANTICS, NULL);
-
-	if (h == INVALID_HANDLE_VALUE) {
-		error(_("[GLE %ld] unable to open for read '%ls'"),
-		      GetLastError(), wpath);
-		return -1;
-	}
-
-	if (!GetFileInformationByHandleEx(h, FileRemoteProtocolInfo,
-		&proto_info, sizeof(proto_info))) {
-		error(_("[GLE %ld] unable to get protocol information for '%ls'"),
-		      GetLastError(), wpath);
-		CloseHandle(h);
-		return -1;
-	}
-
-	CloseHandle(h);
-
-	trace_printf_key(&trace_fsmonitor,
-				"check_remote_protocol('%ls') remote protocol %#8.8lx",
-				wpath, proto_info.Protocol);
-
-	return 0;
-}
-
-/*
- * Remote working directories are problematic for FSMonitor.
- *
- * The underlying file system on the server machine and/or the remote
- * mount type dictates whether notification events are available at
- * all to remote client machines.
- *
- * Kernel differences between the server and client machines also
- * dictate the how (buffering, frequency, de-dup) the events are
- * delivered to client machine processes.
- *
- * A client machine (such as a laptop) may choose to suspend/resume
- * and it is unclear (without lots of testing) whether the watcher can
- * resync after a resume.  We might be able to treat this as a normal
- * "events were dropped by the kernel" event and do our normal "flush
- * and resync" --or-- we might need to close the existing (zombie?)
- * notification fd and create a new one.
- *
- * In theory, the above issues need to be addressed whether we are
- * using the Hook or IPC API.
- *
- * So (for now at least), mark remote working directories as
- * incompatible.
- *
- * Notes for testing:
- *
- * (a) Windows allows a network share to be mapped to a drive letter.
- *     (This is the normal method to access it.)
- *
- *     $ NET USE Z: \\server\share
- *     $ git -C Z:/repo status
- *
- * (b) Windows allows a network share to be referenced WITHOUT mapping
- *     it to drive letter.
- *
- *     $ NET USE \\server\share\dir
- *     $ git -C //server/share/repo status
- *
- * (c) Windows allows "SUBST" to create a fake drive mapping to an
- *     arbitrary path (which may be remote)
- *
- *     $ SUBST Q: Z:\repo
- *     $ git -C Q:/ status
- *
- * (d) Windows allows a directory symlink to be created on a local
- *     file system that points to a remote repo.
- *
- *     $ mklink /d ./link //server/share/repo
- *     $ git -C ./link status
- */
-static enum fsmonitor_reason check_remote(struct repository *r)
-{
-	int ret;
-	wchar_t wpath[MAX_PATH];
-	wchar_t wfullpath[MAX_PATH];
-	size_t wlen;
-	UINT driveType;
-
-	/*
-	 * Do everything in wide chars because the drive letter might be
-	 * a multi-byte sequence.  See win32_has_dos_drive_prefix().
-	 */
-	if (xutftowcs_path(wpath, r->worktree) < 0)
-		return FSMONITOR_REASON_ERROR;
-
-	/*
-	 * GetDriveTypeW() requires a final slash.  We assume that the
-	 * worktree pathname points to an actual directory.
-	 */
-	wlen = wcslen(wpath);
-	if (wpath[wlen - 1] != L'\\' && wpath[wlen - 1] != L'/') {
-		wpath[wlen++] = L'\\';
-		wpath[wlen] = 0;
-	}
-
-	/*
-	 * Normalize the path.  If nothing else, this converts forward
-	 * slashes to backslashes.  This is essential to get GetDriveTypeW()
-	 * correctly handle some UNC "\\server\share\..." paths.
-	 */
-	if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL))
-		return FSMONITOR_REASON_ERROR;
-
-	driveType = GetDriveTypeW(wfullpath);
-	trace_printf_key(&trace_fsmonitor,
-			 "DriveType '%s' L'%ls' (%u)",
-			 r->worktree, wfullpath, driveType);
-
-	if (driveType == DRIVE_REMOTE) {
-		trace_printf_key(&trace_fsmonitor,
-				 "check_remote('%s') true",
-				 r->worktree);
-
-		ret = check_remote_protocol(wfullpath);
-		if (ret < 0)
-			return FSMONITOR_REASON_ERROR;
-
-		switch (check_config_allowremote(r)) {
-		case 0: /* config overrides and disables */
-			return FSMONITOR_REASON_REMOTE;
-		case 1: /* config overrides and enables */
-			return FSMONITOR_REASON_OK;
-		default:
-			break; /* config has no opinion */
-		}
-
-		return FSMONITOR_REASON_REMOTE;
-	}
-
-	return FSMONITOR_REASON_OK;
-}
-
 enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
 {
 	enum fsmonitor_reason reason;
@@ -197,9 +33,5 @@ enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
 	if (reason != FSMONITOR_REASON_OK)
 		return reason;
 
-	reason = check_remote(r);
-	if (reason != FSMONITOR_REASON_OK)
-		return reason;
-
 	return FSMONITOR_REASON_OK;
 }
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ea2a531be87..5482a04b3ce 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -308,6 +308,7 @@ if(SUPPORTS_SIMPLE_IPC)
 		add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-win32.c)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-win32.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-win32.c)
 
 		add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-win32.c)
@@ -315,6 +316,7 @@ if(SUPPORTS_SIMPLE_IPC)
 		add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-darwin.c)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-darwin.c)
+		list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-darwin.c)
 
 		add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
 		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-darwin.c)
diff --git a/fsmonitor-path-utils.h b/fsmonitor-path-utils.h
new file mode 100644
index 00000000000..e48592887e7
--- /dev/null
+++ b/fsmonitor-path-utils.h
@@ -0,0 +1,23 @@
+#ifndef FSM_PATH_UTILS_H
+#define FSM_PATH_UTILS_H
+
+struct fs_info {
+	int is_remote;
+	char *typename;
+};
+
+/*
+ * Get some basic filesystem informtion for the given path
+ *
+ * Returns -1 on error, zero otherwise.
+ */
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info);
+
+/*
+ * Determines if the filesystem that path resides on is remote.
+ *
+ * Returns -1 on error, 0 if not remote, 1 if remote.
+ */
+int fsmonitor__is_fs_remote(const char *path);
+
+#endif
diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c
index 464424a1e92..d288cbad479 100644
--- a/fsmonitor-settings.c
+++ b/fsmonitor-settings.c
@@ -2,6 +2,7 @@
 #include "config.h"
 #include "repository.h"
 #include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
 
 /*
  * We keep this structure defintion private and have getters
@@ -13,6 +14,52 @@ struct fsmonitor_settings {
 	char *hook_path;
 };
 
+/*
+ * Remote working directories are problematic for FSMonitor.
+ *
+ * The underlying file system on the server machine and/or the remote
+ * mount type dictates whether notification events are available at
+ * all to remote client machines.
+ *
+ * Kernel differences between the server and client machines also
+ * dictate the how (buffering, frequency, de-dup) the events are
+ * delivered to client machine processes.
+ *
+ * A client machine (such as a laptop) may choose to suspend/resume
+ * and it is unclear (without lots of testing) whether the watcher can
+ * resync after a resume.  We might be able to treat this as a normal
+ * "events were dropped by the kernel" event and do our normal "flush
+ * and resync" --or-- we might need to close the existing (zombie?)
+ * notification fd and create a new one.
+ *
+ * In theory, the above issues need to be addressed whether we are
+ * using the Hook or IPC API.
+ *
+ * So (for now at least), mark remote working directories as
+ * incompatible unless 'fsmonitor.allowRemote' is true.
+ *
+ */
+#ifdef HAVE_FSMONITOR_OS_SETTINGS
+static enum fsmonitor_reason check_remote(struct repository *r)
+{
+	int allow_remote = -1; /* -1 unset, 0 not allowed, 1 allowed */
+	int is_remote = fsmonitor__is_fs_remote(r->worktree);
+
+	switch (is_remote) {
+		case 0:
+			return FSMONITOR_REASON_OK;
+		case 1:
+			repo_config_get_bool(r, "fsmonitor.allowremote", &allow_remote);
+			if (allow_remote < 1)
+				return FSMONITOR_REASON_REMOTE;
+			else
+				return FSMONITOR_REASON_OK;
+		default:
+			return FSMONITOR_REASON_ERROR;
+	}
+}
+#endif
+
 static enum fsmonitor_reason check_for_incompatible(struct repository *r)
 {
 	if (!r->worktree) {
@@ -27,6 +74,9 @@ static enum fsmonitor_reason check_for_incompatible(struct repository *r)
 	{
 		enum fsmonitor_reason reason;
 
+		reason = check_remote(r);
+		if (reason != FSMONITOR_REASON_OK)
+			return reason;
 		reason = fsm_os__incompatible(r);
 		if (reason != FSMONITOR_REASON_OK)
 			return reason;
-- 
gitgitgadget


  reply	other threads:[~2022-09-27 20:57 UTC|newest]

Thread overview: 170+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 20:48 [PATCH] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-08-18 21:35 ` Junio C Hamano
2022-08-18 21:38   ` Junio C Hamano
2022-08-19 10:05 ` Johannes Schindelin
2022-08-19 16:50 ` Jeff Hostetler
2022-08-19 18:38   ` Eric DeCosta
2022-08-19 20:15     ` Jeff Hostetler
2022-08-19 17:48 ` Eric Sunshine
2022-08-19 18:58 ` Torsten Bögershausen
2022-08-20 22:24 ` Junio C Hamano
2022-08-22 13:22   ` Johannes Schindelin
2022-08-22 16:07     ` Junio C Hamano
2022-08-23 13:51     ` Jeff Hostetler
2022-08-24 15:45       ` Eric DeCosta
2022-08-23 13:03 ` [PATCH v2 0/4] " Eric DeCosta via GitGitGadget
2022-08-23 13:03   ` [PATCH v2 1/4] " Eric DeCosta via GitGitGadget
2022-08-23 13:03   ` [PATCH v2 2/4] fsmonitor: macOS: " Eric DeCosta via GitGitGadget
2022-08-23 13:03   ` [PATCH v2 3/4] Check working directory and Unix domain socket file for compatability edecosta via GitGitGadget
2022-08-23 13:03   ` [PATCH v2 4/4] Minor refactoring and simplification of Windows settings checks edecosta via GitGitGadget
2022-08-23 18:55   ` [PATCH v3 0/2] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-08-23 18:55     ` [PATCH v3 1/2] fsmonitor: macOS: " Eric DeCosta via GitGitGadget
2022-08-23 18:55     ` [PATCH v3 2/2] Check working directory and Unix domain socket file for compatability edecosta via GitGitGadget
2022-08-24 20:31       ` Junio C Hamano
2022-08-24 16:46     ` [PATCH v3 0/2] fsmonitor: option to allow fsmonitor to run against network-mounted repos Junio C Hamano
2022-08-31 16:09     ` [PATCH v4 0/4] " Eric DeCosta via GitGitGadget
2022-08-31 16:09       ` [PATCH v4 1/4] fsmonitor: add two new config options, allowRemote and socketDir Eric DeCosta via GitGitGadget
2022-08-31 19:41         ` Ævar Arnfjörð Bjarmason
2022-08-31 20:04         ` Junio C Hamano
2022-09-01  2:25           ` Ramsay Jones
2022-09-01 17:53         ` Jeff Hostetler
2022-09-01 18:04         ` Jeff Hostetler
2022-09-01 21:21         ` Jeff Hostetler
2022-09-02 16:54           ` Eric DeCosta
2022-09-06 14:27             ` Jeff Hostetler
2022-08-31 16:09       ` [PATCH v4 2/4] fsmonitor: generate unique Unix socket file name in the desired location Eric DeCosta via GitGitGadget
2022-08-31 19:49         ` Ævar Arnfjörð Bjarmason
2022-08-31 20:11         ` Junio C Hamano
2022-08-31 16:09       ` [PATCH v4 3/4] fsmonitor: ensure filesystem and unix socket filesystem are compatible Eric DeCosta via GitGitGadget
2022-08-31 16:09       ` [PATCH v4 4/4] fsmonitor: normalize FSEvents event paths to the real path Eric DeCosta via GitGitGadget
2022-08-31 19:37         ` Ævar Arnfjörð Bjarmason
2022-09-01 20:05         ` Jeff Hostetler
2022-09-02 16:35           ` Eric DeCosta
2022-09-06 17:13             ` Jeff Hostetler
2022-09-06 19:02               ` Eric DeCosta
2022-09-06 19:33                 ` Eric DeCosta
2022-09-06 22:11                   ` Eric DeCosta
2022-09-07 19:14                   ` Jeff Hostetler
2022-09-07 23:04                     ` Eric DeCosta
2022-09-10 20:00       ` [PATCH v5 0/4] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-10 20:00         ` [PATCH v5 1/4] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-10 20:00         ` [PATCH v5 2/4] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-10 20:00         ` [PATCH v5 3/4] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-10 20:00         ` [PATCH v5 4/4] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-11  1:01           ` Eric Sunshine
2022-09-12 15:27         ` [PATCH v5 0/4] fsmonitor: option to allow fsmonitor to run against network-mounted repos Junio C Hamano
2022-09-12 19:37           ` Junio C Hamano
2022-09-12 19:39             ` Eric DeCosta
2022-09-12 15:35         ` Junio C Hamano
2022-09-12 19:35           ` Eric DeCosta
2022-09-13 20:27         ` [PATCH v6 0/6] " Eric DeCosta via GitGitGadget
2022-09-13 20:27           ` [PATCH v6 1/6] " Eric DeCosta via GitGitGadget
2022-09-13 20:27           ` [PATCH v6 2/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-13 20:27           ` [PATCH v6 3/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-14  0:48             ` Junio C Hamano
2022-09-14 15:47               ` Eric DeCosta
2022-09-13 20:27           ` [PATCH v6 4/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-14  1:48             ` Junio C Hamano
2022-09-13 20:27           ` [PATCH v6 5/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-13 20:27           ` [PATCH v6 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-16 17:58           ` [PATCH v6 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Jeff Hostetler
2022-09-16 20:02             ` Eric DeCosta
2022-09-16 19:53           ` [PATCH v7 " Eric DeCosta via GitGitGadget
2022-09-16 19:53             ` [PATCH v7 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-16 19:53             ` [PATCH v7 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-16 20:11               ` Junio C Hamano
2022-09-19 12:31                 ` Jeff Hostetler
2022-09-19 16:42                   ` Junio C Hamano
2022-09-19 17:08                     ` Jeff Hostetler
2022-09-19 17:49                       ` Junio C Hamano
2022-09-19 23:51                         ` Eric DeCosta
2022-09-20 14:35                           ` Jeff Hostetler
2022-09-20 15:49                             ` Eric DeCosta
2022-09-16 19:53             ` [PATCH v7 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-16 19:53             ` [PATCH v7 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-16 19:53             ` [PATCH v7 5/6] " Eric DeCosta via GitGitGadget
2022-09-16 20:15               ` Junio C Hamano
2022-09-16 19:53             ` [PATCH v7 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-16 20:09             ` [PATCH v7 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Junio C Hamano
2022-09-17  1:12             ` [PATCH v8 0/5] " Eric DeCosta via GitGitGadget
2022-09-17  1:12               ` [PATCH v8 1/5] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-17  1:12               ` [PATCH v8 2/5] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-17  4:13                 ` Eric Sunshine
2022-09-19 16:50                   ` Junio C Hamano
2022-09-17  6:29                 ` Eric Sunshine
2022-09-17 16:29                   ` Eric DeCosta
2022-09-19 16:58                   ` Junio C Hamano
2022-09-17  1:12               ` [PATCH v8 3/5] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-17  1:12               ` [PATCH v8 4/5] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-17  1:12               ` [PATCH v8 5/5] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-17  6:08                 ` Eric Sunshine
2022-09-19 23:55                   ` Eric DeCosta
2022-09-19 19:37               ` [PATCH v9 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-19 19:37                 ` [PATCH v9 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-19 19:37                 ` [PATCH v9 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-19 19:57                   ` Eric Sunshine
2022-09-19 19:37                 ` [PATCH v9 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-19 19:37                 ` [PATCH v9 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-19 19:37                 ` [PATCH v9 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-19 19:37                 ` [PATCH v9 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-20 20:33                 ` [PATCH v10 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-20 20:33                   ` [PATCH v10 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-20 20:33                   ` [PATCH v10 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-20 20:33                   ` [PATCH v10 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-20 20:33                   ` [PATCH v10 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-20 20:33                   ` [PATCH v10 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-21 11:22                     ` Jeff Hostetler
2022-09-21 13:03                       ` Eric DeCosta
2022-09-20 20:33                   ` [PATCH v10 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-21 22:18                   ` [PATCH v11 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-21 22:18                     ` [PATCH v11 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-24 19:46                     ` [PATCH v12 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-24 19:46                       ` [PATCH v12 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-24 19:46                       ` [PATCH v12 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-24 19:46                       ` [PATCH v12 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-24 19:46                       ` [PATCH v12 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-26 15:16                         ` Ævar Arnfjörð Bjarmason
2022-09-27  1:53                           ` Eric DeCosta
2022-09-26 15:27                         ` Ævar Arnfjörð Bjarmason
2022-09-24 19:46                       ` [PATCH v12 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-25 14:00                         ` Eric DeCosta
2022-09-26 15:23                         ` Ævar Arnfjörð Bjarmason
2022-09-27  1:25                           ` Eric DeCosta
2022-09-24 19:46                       ` [PATCH v12 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-26 15:11                         ` Ævar Arnfjörð Bjarmason
2022-09-27  2:16                           ` Eric Sunshine
2022-09-27  4:03                             ` Eric DeCosta
2022-09-25 14:18                       ` [PATCH v12 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta
2022-09-27 20:57                       ` [PATCH v13 " Eric DeCosta via GitGitGadget
2022-09-27 20:57                         ` Eric DeCosta via GitGitGadget [this message]
2022-09-27 20:57                         ` [PATCH v13 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-27 20:57                         ` [PATCH v13 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-27 20:57                         ` [PATCH v13 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-28  5:55                           ` Ævar Arnfjörð Bjarmason
2022-09-27 20:57                         ` [PATCH v13 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-27 20:57                         ` [PATCH v13 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-09-28 20:12                         ` [PATCH v14 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-09-28 20:12                           ` [PATCH v14 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2022-10-04 17:32                           ` [PATCH v15 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Eric DeCosta via GitGitGadget
2022-10-04 17:32                             ` [PATCH v15 1/6] fsmonitor: refactor filesystem checks to common interface Eric DeCosta via GitGitGadget
2023-01-30  9:37                               ` Ævar Arnfjörð Bjarmason
2022-10-04 17:32                             ` [PATCH v15 2/6] fsmonitor: relocate socket file if .git directory is remote Eric DeCosta via GitGitGadget
2023-01-30  9:58                               ` Ævar Arnfjörð Bjarmason
2022-10-04 17:32                             ` [PATCH v15 3/6] fsmonitor: avoid socket location check if using hook Eric DeCosta via GitGitGadget
2022-10-04 17:32                             ` [PATCH v15 4/6] fsmonitor: deal with synthetic firmlinks on macOS Eric DeCosta via GitGitGadget
2023-01-30 10:08                               ` Ævar Arnfjörð Bjarmason
2022-10-04 17:32                             ` [PATCH v15 5/6] fsmonitor: check for compatability before communicating with fsmonitor Eric DeCosta via GitGitGadget
2022-10-04 17:32                             ` [PATCH v15 6/6] fsmonitor: add documentation for allowRemote and socketDir options Eric DeCosta via GitGitGadget
2023-01-30 10:04                               ` Ævar Arnfjörð Bjarmason
2022-10-05 18:05                             ` [PATCH v15 0/6] fsmonitor: option to allow fsmonitor to run against network-mounted repos Junio C Hamano
2022-10-05 21:14                               ` Eric DeCosta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b9b64428c5e096ada1f274639be9604e8c2f9ed.1664312254.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=edecosta@mathworks.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sunshine@sunshineco.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).