mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-26 03:51:40 -05:00
fsmonitor-settings: virtual repos are incompatible with FSMonitor
Virtual repos, such as GVFS (aka VFS for Git), are incompatible with FSMonitor. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
committed by
Johannes Schindelin
parent
d3896d5338
commit
3b767d749c
@@ -3,7 +3,33 @@
|
||||
#include "repository.h"
|
||||
#include "fsmonitor-settings.h"
|
||||
|
||||
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
|
||||
/*
|
||||
* GVFS (aka VFS for Git) is incompatible with FSMonitor.
|
||||
*
|
||||
* Granted, core Git does not know anything about GVFS 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 GVFS
|
||||
* 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 is_virtual(struct repository *r)
|
||||
{
|
||||
const char *const_str;
|
||||
|
||||
if (!repo_config_get_value(r, "core.virtualfilesystem", &const_str))
|
||||
return FSMONITOR_REASON_VIRTUAL;
|
||||
|
||||
return FSMONITOR_REASON_ZERO;
|
||||
}
|
||||
|
||||
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
|
||||
{
|
||||
enum fsmonitor_reason reason;
|
||||
|
||||
reason = is_virtual(r);
|
||||
if (reason)
|
||||
return reason;
|
||||
|
||||
return FSMONITOR_REASON_ZERO;
|
||||
}
|
||||
|
||||
@@ -155,6 +155,11 @@ static void create_reason_message(struct repository *r,
|
||||
_("bare repos are incompatible with fsmonitor"));
|
||||
return;
|
||||
|
||||
case FSMONITOR_REASON_VIRTUAL:
|
||||
strbuf_addstr(buf_reason,
|
||||
_("virtual repos are incompatible with fsmonitor"));
|
||||
return;
|
||||
|
||||
default:
|
||||
BUG("Unhandled case in create_reason_message '%d'", s->reason);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ enum fsmonitor_mode {
|
||||
enum fsmonitor_reason {
|
||||
FSMONITOR_REASON_ZERO = 0,
|
||||
FSMONITOR_REASON_BARE = 1,
|
||||
FSMONITOR_REASON_VIRTUAL = 2,
|
||||
};
|
||||
|
||||
void fsm_settings__set_ipc(struct repository *r);
|
||||
|
||||
@@ -81,6 +81,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 &&
|
||||
|
||||
Reference in New Issue
Block a user