The IPC socket used by the fsmonitor on Darwin is usually contained in the Git repository itself. When the repository is hosted on a networked filesystem though, we instead create the socket path in the user's home directory or the socket directory. In that case, we derive the path by hashing the repository path. The hashing implicitly depends on `the_repository` though via `hash_to_hex()`. For one, this is wrong because we really should be using the passed-in repository. But arguably, it is not sensible to derive the path hash from the repository's object hash in the first place -- they don't have anything to do with each other, and a repository that is hosted in the same path should always derive the same IPC socket path. Fix this by unconditionally using SHA1 to derive the path. Signed-off-by: Patrick Steinhardt <ps@xxxxxx> --- compat/fsmonitor/fsm-ipc-darwin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index 6f3a95410c..b4d21d6dc2 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -41,9 +41,10 @@ const char *fsmonitor_ipc__get_path(struct repository *r) /* Create the socket file in either socketDir or $HOME */ if (sock_dir && *sock_dir) { strbuf_addf(&ipc_file, "%s/.git-fsmonitor-%s", - sock_dir, hash_to_hex(hash)); + sock_dir, hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1])); } else { - strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", hash_to_hex(hash)); + strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", + hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1])); } free(sock_dir); -- 2.45.2.436.gcd77e87115.dirty
Attachment:
signature.asc
Description: PGP signature