]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsmonitor--daemon: on macOS support symlink
authorsrz_zumix <zumix.cpp@gmail.com>
Tue, 8 Nov 2022 05:25:19 +0000 (05:25 +0000)
committerTaylor Blau <me@ttaylorr.com>
Tue, 8 Nov 2022 21:36:09 +0000 (16:36 -0500)
Resolves a problem where symbolic links were not showing up in diff when
created or modified.

kFSEventStreamEventFlagItemIsSymlink is also treated as a file update.
This is because kFSEventStreamEventFlagItemIsFile is not included in
FSEvents when creating or deleting symbolic links. For example:

$ ln -snf t test
  fsevent: '/path/to/dir/test', flags=0x40100 ItemCreated|ItemIsSymlink|
$ ln -snf ci test
  fsevent: '/path/to/dir/test', flags=0x40200 ItemIsSymlink|ItemRemoved|
  fsevent: '/path/to/dir/test', flags=0x40100 ItemCreated|ItemIsSymlink|

Signed-off-by: srz_zumix <zumix.cpp@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
compat/fsmonitor/fsm-listen-darwin.c

index daeee4e465c1246df1ca254403b81d8c0d2220ac..cc9af1e3cb3b3afca7d519147c4ae252b9f5832a 100644 (file)
@@ -336,7 +336,7 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
                         * know how much to invalidate/refresh.
                         */
 
-                       if (event_flags[k] & kFSEventStreamEventFlagItemIsFile) {
+                       if (event_flags[k] & (kFSEventStreamEventFlagItemIsFile | kFSEventStreamEventFlagItemIsSymlink)) {
                                const char *rel = path_k +
                                        state->path_worktree_watch.len + 1;