@@ -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;
}
@@ -177,6 +177,9 @@ const char *fsm_settings__get_reason_msg(struct repository *r)
case FSMONITOR_REASON_BARE:
return _("bare repos are incompatible with fsmonitor");
+
+ case FSMONITOR_REASON_VFS4GIT:
+ return _("virtual repos are incompatible with fsmonitor");
}
BUG("Unhandled case in fsm_settings__get_reason_msg '%d'",
@@ -16,6 +16,7 @@ enum fsmonitor_mode {
enum fsmonitor_reason {
FSMONITOR_REASON_OK = 0, /* no incompatibility or when disbled */
FSMONITOR_REASON_BARE,
+ FSMONITOR_REASON_VFS4GIT, /* VFS for Git virtualization */
};
void fsm_settings__set_ipc(struct repository *r);
@@ -78,6 +78,15 @@ test_expect_success FSMONITOR_DAEMON 'run fsmonitor-daemon in bare repo' '
grep "bare repos are incompatible with fsmonitor" actual
'
+test_expect_success MINGW,FSMONITOR_DAEMON 'run fsmonitor-daemon in virtual repo' '
+ test_when_finished "rm -rf ./fake-virtual-clone actual" &&
+ git init fake-virtual-clone &&
+ test_must_fail git -C ./fake-virtual-clone \
+ -c core.virtualfilesystem=true \
+ fsmonitor--daemon run 2>actual &&
+ grep "virtual repos are incompatible with fsmonitor" actual
+'
+
test_expect_success 'setup' '
mkdir -p .git/hooks &&
: >tracked &&