summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2022-05-26 21:47:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-26 22:59:26 (GMT)
commit5c58fbd26579391d825cb1ef0df8703bd6fd0ed5 (patch)
tree9ce88463c9cfbb857aea9b8a0920426525a7092c /compat
parentd33c804daec8aaf1e8af187c00166ef4cb017262 (diff)
downloadgit-5c58fbd26579391d825cb1ef0df8703bd6fd0ed5.zip
git-5c58fbd26579391d825cb1ef0df8703bd6fd0ed5.tar.gz
git-5c58fbd26579391d825cb1ef0df8703bd6fd0ed5.tar.bz2
fsmonitor-settings: VFS for Git virtual repos are incompatible
VFS for Git virtual repositories are incompatible with FSMonitor. VFS for Git is a downstream fork of Git. It contains its own custom file system watcher that is aware of the virtualization. If a working directory is being managed by VFS for Git, we should not try to watch it because we may get incomplete results. We do not know anything about how VFS for Git works, but we do know that VFS for Git working directories contain a well-defined config setting. If it is set, mark the working directory as incompatible. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/fsmonitor/fsm-settings-win32.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/compat/fsmonitor/fsm-settings-win32.c b/compat/fsmonitor/fsm-settings-win32.c
index 7fce32a..ee78bba 100644
--- a/compat/fsmonitor/fsm-settings-win32.c
+++ b/compat/fsmonitor/fsm-settings-win32.c
@@ -3,7 +3,33 @@
#include "repository.h"
#include "fsmonitor-settings.h"
+/*
+ * VFS for Git is incompatible with FSMonitor.
+ *
+ * Granted, core Git does not know anything about VFS for Git and we
+ * shouldn't make assumptions about a downstream feature, but users
+ * can install both versions. And this can lead to incorrect results
+ * from core Git commands. So, without bringing in any of the VFS for
+ * Git code, do a simple config test for a published config setting.
+ * (We do not look at the various *_TEST_* environment variables.)
+ */
+static enum fsmonitor_reason check_vfs4git(struct repository *r)
+{
+ const char *const_str;
+
+ if (!repo_config_get_value(r, "core.virtualfilesystem", &const_str))
+ return FSMONITOR_REASON_VFS4GIT;
+
+ return FSMONITOR_REASON_OK;
+}
+
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
{
+ enum fsmonitor_reason reason;
+
+ reason = check_vfs4git(r);
+ if (reason != FSMONITOR_REASON_OK)
+ return reason;
+
return FSMONITOR_REASON_OK;
}