git/compat/fsmonitor
Eric DeCosta 12fd27df79 fsmonitor: deal with synthetic firmlinks on macOS
Starting with macOS 10.15 (Catalina), Apple introduced a new feature
called 'firmlinks' in order to separate the boot volume into two
volumes, one read-only and one writable but still present them to the
user as a single volume. Along with this change, Apple removed the
ability to create symlinks in the root directory and replaced them with
'synthetic firmlinks'. See 'man synthetic.conf'

When FSEevents reports the path of changed files, if the path involves
a synthetic firmlink, the path is reported from the point of the
synthetic firmlink and not the real path. For example:

Real path:
/System/Volumes/Data/network/working/directory/foo.txt

Synthetic firmlink:
/network -> /System/Volumes/Data/network

FSEvents path:
/network/working/directory/foo.txt

This causes the FSEvents path to not match against the worktree
directory.

There are several ways in which synthetic firmlinks can be created:
they can be defined in /etc/synthetic.conf, the automounter can create
them, and there may be other means. Simply reading /etc/synthetic.conf
is insufficient. No matter what process creates synthetic firmlinks,
they all get created in the root directory.

Therefore, in order to deal with synthetic firmlinks, the root directory
is scanned and the first possible synthetic firmink that, when resolved,
is a prefix of the worktree is used to map FSEvents paths to worktree
paths.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-05 11:05:23 -07:00
..
fsm-darwin-gcc.h compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent 2022-03-25 16:04:16 -07:00
fsm-health-darwin.c fsmonitor--daemon: stub in health thread 2022-05-26 15:59:27 -07:00
fsm-health-win32.c fsm-health-win32: force shutdown daemon if worktree root moves 2022-05-26 15:59:27 -07:00
fsm-health.h fsmonitor--daemon: stub in health thread 2022-05-26 15:59:27 -07:00
fsm-ipc-darwin.c fsmonitor: relocate socket file if .git directory is remote 2022-10-05 11:05:22 -07:00
fsm-ipc-win32.c fsmonitor: relocate socket file if .git directory is remote 2022-10-05 11:05:22 -07:00
fsm-listen-darwin.c fsmonitor: deal with synthetic firmlinks on macOS 2022-10-05 11:05:23 -07:00
fsm-listen-win32.c fsmonitor--daemon: rename listener thread related variables 2022-05-26 15:59:26 -07:00
fsm-listen.h fsmonitor--daemon: rename listener thread related variables 2022-05-26 15:59:26 -07:00
fsm-path-utils-darwin.c fsmonitor: deal with synthetic firmlinks on macOS 2022-10-05 11:05:23 -07:00
fsm-path-utils-win32.c fsmonitor: deal with synthetic firmlinks on macOS 2022-10-05 11:05:23 -07:00
fsm-settings-darwin.c fsmonitor: avoid socket location check if using hook 2022-10-05 11:05:23 -07:00
fsm-settings-win32.c fsmonitor: avoid socket location check if using hook 2022-10-05 11:05:23 -07:00