# [PATCH] fsmonitor--daemon: on macOS support symlink

3 messages from 2022-11-08 to 2022-11-15. Participants: srz_zumix via GitGitGadget, Taylor Blau, Jeff Hostetler.
Thread: https://gitlist.dev/t/58761

## srz_zumix via GitGitGadget, 2022-11-08 05:25

Subject: [PATCH] fsmonitor--daemon: on macOS support symlink
Message-ID: <pull.1406.git.1667885119570.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1406.git.1667885119570.gitgitgadget%40gmail.com

```
From: srz_zumix <zumix.cpp@gmail.com>

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>
---
    fsmonitor--daemon: on macOS support symlink
    
    Resolves a problem where symbolic links were not showing up in diff when
    created or modified. (on macOS with git config core.fsmonitor=true)

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1406%2Fsrz-zumix%2Ffeature%2Fdarwin_symlink-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1406/srz-zumix/feature/darwin_symlink-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1406

 compat/fsmonitor/fsm-listen-darwin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c
index daeee4e465c..cc9af1e3cb3 100644
--- a/compat/fsmonitor/fsm-listen-darwin.c
+++ b/compat/fsmonitor/fsm-listen-darwin.c
@@ -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;
 

base-commit: 3b08839926fcc7cc48cf4c759737c1a71af430c1
-- 
gitgitgadget

```

## Taylor Blau, 2022-11-08 21:35

Subject: Re: [PATCH] fsmonitor--daemon: on macOS support symlink
Message-ID: <Y2rLr5zJTnqownCT@nand.local>
URL: https://gitlist.dev/e/Y2rLr5zJTnqownCT%40nand.local
In-Reply-To: <pull.1406.git.1667885119570.gitgitgadget@gmail.com>

```
On Tue, Nov 08, 2022 at 05:25:19AM +0000, srz_zumix via GitGitGadget wrote:
> From: srz_zumix <zumix.cpp@gmail.com>
>
> Resolves a problem where symbolic links were not showing up in diff when
> created or modified.

Looks reasonable to me. Adding Jeff Hostetler (cc'd) as a possible
reviewer.

Thanks,
Taylor

```

## Jeff Hostetler, 2022-11-15 16:14

Subject: Re: [PATCH] fsmonitor--daemon: on macOS support symlink
Message-ID: <7ca10b13-7041-c730-c92f-4cff07783746@jeffhostetler.com>
URL: https://gitlist.dev/e/7ca10b13-7041-c730-c92f-4cff07783746%40jeffhostetler.com
In-Reply-To: <Y2rLr5zJTnqownCT@nand.local>

```


On 11/8/22 4:35 PM, Taylor Blau wrote:
> On Tue, Nov 08, 2022 at 05:25:19AM +0000, srz_zumix via GitGitGadget wrote:
>> From: srz_zumix <zumix.cpp@gmail.com>
>>
>> Resolves a problem where symbolic links were not showing up in diff when
>> created or modified.
> 
> Looks reasonable to me. Adding Jeff Hostetler (cc'd) as a possible
> reviewer.
> 
> Thanks,
> Taylor

This looks good to me too.  Thanks!

```
