Skip to content

Commit d2ed07d

Browse files
committed
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 <[email protected]>
1 parent ff00eee commit d2ed07d

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

compat/fsmonitor/fsm-settings-win32.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,33 @@
33
#include "repository.h"
44
#include "fsmonitor-settings.h"
55

6+
/*
7+
* GVFS (aka VFS for Git) is incompatible with FSMonitor.
8+
*
9+
* Granted, core Git does not know anything about GVFS and we
10+
* shouldn't make assumptions about a downstream feature, but users
11+
* can install both versions. And this can lead to incorrect results
12+
* from core Git commands. So, without bringing in any of the GVFS
13+
* code, do a simple config test for a published config setting. (We
14+
* do not look at the various *_TEST_* environment variables.)
15+
*/
16+
static enum fsmonitor_reason is_virtual(struct repository *r)
17+
{
18+
const char *const_str;
19+
20+
if (!repo_config_get_value(r, "core.virtualfilesystem", &const_str))
21+
return FSMONITOR_REASON_VIRTUAL;
22+
23+
return FSMONITOR_REASON_ZERO;
24+
}
25+
626
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
727
{
28+
enum fsmonitor_reason reason;
29+
30+
reason = is_virtual(r);
31+
if (reason)
32+
return reason;
33+
834
return FSMONITOR_REASON_ZERO;
935
}

fsmonitor-settings.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ static void create_reason_message(struct repository *r,
155155
_("bare repos are incompatible with fsmonitor"));
156156
return;
157157

158+
case FSMONITOR_REASON_VIRTUAL:
159+
strbuf_addstr(buf_reason,
160+
_("virtual repos are incompatible with fsmonitor"));
161+
return;
162+
158163
default:
159164
BUG("Unhandled case in create_reason_message '%d'", s->reason);
160165
}

fsmonitor-settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum fsmonitor_mode {
1616
enum fsmonitor_reason {
1717
FSMONITOR_REASON_ZERO = 0,
1818
FSMONITOR_REASON_BARE = 1,
19+
FSMONITOR_REASON_VIRTUAL = 2,
1920
};
2021

2122
void fsm_settings__set_ipc(struct repository *r);

t/t7519-status-fsmonitor.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ test_expect_success FSMONITOR_DAEMON 'run fsmonitor-daemon in bare repo' '
8181
grep "bare repos are incompatible with fsmonitor" actual
8282
'
8383

84+
test_expect_success MINGW,FSMONITOR_DAEMON 'run fsmonitor-daemon in virtual repo' '
85+
test_when_finished "rm -rf ./fake-virtual-clone actual" &&
86+
git init fake-virtual-clone &&
87+
test_must_fail git -C ./fake-virtual-clone \
88+
-c core.virtualfilesystem=true \
89+
fsmonitor--daemon run 2>actual &&
90+
grep "virtual repos are incompatible with fsmonitor" actual
91+
'
92+
8493
test_expect_success 'setup' '
8594
mkdir -p .git/hooks &&
8695
: >tracked &&

0 commit comments

Comments
 (0)