| 1 | #include "git-compat-util.h" |
| 2 | #include "config.h" |
| 3 | #include "repository.h" |
| 4 | #include "fsmonitor-ll.h" |
| 5 | #include "fsmonitor-settings.h" |
| 6 | #include "fsmonitor-path-utils.h" |
| 7 | |
| 8 | /* |
| 9 | * VFS for Git is incompatible with FSMonitor. |
| 10 | * |
| 11 | * Granted, core Git does not know anything about VFS for Git and we |
| 12 | * shouldn't make assumptions about a downstream feature, but users |
| 13 | * can install both versions. And this can lead to incorrect results |
| 14 | * from core Git commands. So, without bringing in any of the VFS for |
| 15 | * Git code, do a simple config test for a published config setting. |
| 16 | * (We do not look at the various *_TEST_* environment variables.) |
| 17 | */ |
| 18 | static enum fsmonitor_reason check_vfs4git(struct repository *r) |
| 19 | { |
| 20 | const char *const_str; |
| 21 | |
| 22 | if (!repo_config_get_value(r, "core.virtualfilesystem", &const_str)) |
| 23 | return FSMONITOR_REASON_VFS4GIT; |
| 24 | |
| 25 | return FSMONITOR_REASON_OK; |
| 26 | } |
| 27 | |
| 28 | enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc UNUSED) |
| 29 | { |
| 30 | enum fsmonitor_reason reason; |
| 31 | |
| 32 | reason = check_vfs4git(r); |
| 33 | if (reason != FSMONITOR_REASON_OK) |
| 34 | return reason; |
| 35 | |
| 36 | return FSMONITOR_REASON_OK; |
| 37 | } |