Skip to content

Commit 30d3405

Browse files
ptarjangitster
authored andcommitted
fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c
The fsmonitor IPC path logic in fsm-ipc-darwin.c is not Darwin-specific and will be reused by the upcoming Linux implementation. Rename it to fsm-ipc-unix.c to reflect that it is shared by all Unix platforms. Introduce FSMONITOR_OS_SETTINGS (set to "unix" for non-Windows, "win32" for Windows) as a separate variable from FSMONITOR_DAEMON_BACKEND so that the build files can distinguish between platform-specific files (listen, health, path-utils) and shared Unix files (ipc, settings). Move fsm-ipc to the FSMONITOR_OS_SETTINGS section in the Makefile, and switch fsm-path-utils to use FSMONITOR_DAEMON_BACKEND since path-utils is platform-specific (there will be separate darwin and linux versions). Based-on-patch-by: Eric DeCosta <edecosta@mathworks.com> Based-on-patch-by: Marziyeh Esipreh <marziyeh.esipreh@gmail.com> Signed-off-by: Paul Tarjan <github@paulisageek.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7d6126d commit 30d3405

5 files changed

Lines changed: 21 additions & 19 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ include shared.mak
408408
# If your platform has OS-specific ways to tell if a repo is incompatible with
409409
# fsmonitor (whether the hook or IPC daemon version), set FSMONITOR_OS_SETTINGS
410410
# to the "<name>" of the corresponding `compat/fsmonitor/fsm-settings-<name>.c`
411-
# that implements the `fsm_os_settings__*()` routines.
411+
# and `compat/fsmonitor/fsm-ipc-<name>.c` files.
412412
#
413413
# Define LINK_FUZZ_PROGRAMS if you want `make all` to also build the fuzz test
414414
# programs in oss-fuzz/.
@@ -2323,13 +2323,13 @@ ifdef FSMONITOR_DAEMON_BACKEND
23232323
COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
23242324
COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
23252325
COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
2326-
COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
23272326
endif
23282327

23292328
ifdef FSMONITOR_OS_SETTINGS
23302329
COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
2330+
COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_OS_SETTINGS).o
23312331
COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
2332-
COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
2332+
COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_BACKEND).o
23332333
endif
23342334

23352335
ifdef WITH_BREAKING_CHANGES

config.mak.uname

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ ifeq ($(uname_S),Darwin)
178178
ifndef NO_PTHREADS
179179
ifndef NO_UNIX_SOCKETS
180180
FSMONITOR_DAEMON_BACKEND = darwin
181-
FSMONITOR_OS_SETTINGS = darwin
181+
FSMONITOR_OS_SETTINGS = unix
182182
endif
183183
endif
184184

contrib/buildsystems/CMakeLists.txt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,22 @@ endif()
291291

292292
if(SUPPORTS_SIMPLE_IPC)
293293
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
294-
add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
295-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-win32.c)
296-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-win32.c)
297-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-win32.c)
298-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-win32.c)
299-
300-
add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
301-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-win32.c)
294+
set(FSMONITOR_DAEMON_BACKEND "win32")
295+
set(FSMONITOR_OS_SETTINGS "win32")
302296
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
297+
set(FSMONITOR_DAEMON_BACKEND "darwin")
298+
set(FSMONITOR_OS_SETTINGS "unix")
299+
endif()
300+
301+
if(FSMONITOR_DAEMON_BACKEND)
303302
add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
304-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-darwin.c)
305-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-darwin.c)
306-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-darwin.c)
307-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-darwin.c)
303+
list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-${FSMONITOR_DAEMON_BACKEND}.c)
304+
list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-${FSMONITOR_DAEMON_BACKEND}.c)
305+
list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-${FSMONITOR_OS_SETTINGS}.c)
306+
list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-${FSMONITOR_DAEMON_BACKEND}.c)
308307

309308
add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
310-
list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-darwin.c)
309+
list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-${FSMONITOR_DAEMON_BACKEND}.c)
311310
endif()
312311
endif()
313312

meson.build

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,10 +1320,13 @@ else
13201320
endif
13211321

13221322
fsmonitor_backend = ''
1323+
fsmonitor_os = ''
13231324
if host_machine.system() == 'windows'
13241325
fsmonitor_backend = 'win32'
1326+
fsmonitor_os = 'win32'
13251327
elif host_machine.system() == 'darwin'
13261328
fsmonitor_backend = 'darwin'
1329+
fsmonitor_os = 'unix'
13271330
libgit_dependencies += dependency('CoreServices')
13281331
endif
13291332
if fsmonitor_backend != ''
@@ -1332,14 +1335,14 @@ if fsmonitor_backend != ''
13321335

13331336
libgit_sources += [
13341337
'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
1335-
'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
1338+
'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
13361339
'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
13371340
'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
13381341
'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
13391342
]
13401343
endif
13411344
build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
1342-
build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
1345+
build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_os)
13431346

13441347
if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
13451348
build_options_config.set('NO_REGEX', '')

0 commit comments

Comments
 (0)