Skip to content

Commit 8f44976

Browse files
edecosta-mwgitster
authored andcommitted
fsmonitor: avoid socket location check if using hook
If monitoring is done via fsmonitor hook rather than IPC there is no need to check if the location of the Unix Domain socket (UDS) file is on a remote filesystem. Signed-off-by: Eric DeCosta <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6beb268 commit 8f44976

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

compat/fsmonitor/fsm-settings-darwin.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ static enum fsmonitor_reason check_uds_volume(struct repository *r)
4848
return FSMONITOR_REASON_OK;
4949
}
5050

51-
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
51+
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
5252
{
5353
enum fsmonitor_reason reason;
5454

55-
reason = check_uds_volume(r);
56-
if (reason != FSMONITOR_REASON_OK)
57-
return reason;
55+
if (ipc) {
56+
reason = check_uds_volume(r);
57+
if (reason != FSMONITOR_REASON_OK)
58+
return reason;
59+
}
5860

5961
return FSMONITOR_REASON_OK;
6062
}

compat/fsmonitor/fsm-settings-win32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
2525
return FSMONITOR_REASON_OK;
2626
}
2727

28-
enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
28+
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
2929
{
3030
enum fsmonitor_reason reason;
3131

fsmonitor-settings.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static enum fsmonitor_reason check_remote(struct repository *r)
6060
}
6161
#endif
6262

63-
static enum fsmonitor_reason check_for_incompatible(struct repository *r)
63+
static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
6464
{
6565
if (!r->worktree) {
6666
/*
@@ -77,7 +77,7 @@ static enum fsmonitor_reason check_for_incompatible(struct repository *r)
7777
reason = check_remote(r);
7878
if (reason != FSMONITOR_REASON_OK)
7979
return reason;
80-
reason = fsm_os__incompatible(r);
80+
reason = fsm_os__incompatible(r, ipc);
8181
if (reason != FSMONITOR_REASON_OK)
8282
return reason;
8383
}
@@ -162,7 +162,7 @@ const char *fsm_settings__get_hook_path(struct repository *r)
162162

163163
void fsm_settings__set_ipc(struct repository *r)
164164
{
165-
enum fsmonitor_reason reason = check_for_incompatible(r);
165+
enum fsmonitor_reason reason = check_for_incompatible(r, 1);
166166

167167
if (reason != FSMONITOR_REASON_OK) {
168168
fsm_settings__set_incompatible(r, reason);
@@ -185,7 +185,7 @@ void fsm_settings__set_ipc(struct repository *r)
185185

186186
void fsm_settings__set_hook(struct repository *r, const char *path)
187187
{
188-
enum fsmonitor_reason reason = check_for_incompatible(r);
188+
enum fsmonitor_reason reason = check_for_incompatible(r, 0);
189189

190190
if (reason != FSMONITOR_REASON_OK) {
191191
fsm_settings__set_incompatible(r, reason);

fsmonitor-settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct fsmonitor_settings;
4848
* fsm_os__* routines should considered private to fsm_settings__
4949
* routines.
5050
*/
51-
enum fsmonitor_reason fsm_os__incompatible(struct repository *r);
51+
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc);
5252
#endif /* HAVE_FSMONITOR_OS_SETTINGS */
5353

5454
#endif /* FSMONITOR_SETTINGS_H */

0 commit comments

Comments
 (0)