Re: [PATCH v7 2/6] fsmonitor: relocate socket file if .git directory is remote
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 16, 2022, 20:11 UTC
- Message-ID
- <xmqqy1ujf5a9.fsf@gitster.g>
- In-Reply-To
- <075340bd2a713905d8bee4f53765dcbcba9a17c4.1663358014.git.gitgitgadget@gmail.com>
"Eric DeCosta via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 13 quoted lines
> +const char *fsmonitor_ipc__get_path(struct repository *r)
> +{
> + static const char *ipc_path;
> + SHA_CTX sha1ctx;
> + char *sock_dir;
> + struct strbuf ipc_file = STRBUF_INIT;
> + unsigned char hash[SHA_DIGEST_LENGTH];
> +
> + if (ipc_path)
> + return ipc_path;
> +
> + if (!r)
> + r = the_repository;I'd prefer not to see this "NULL means the_repository". It would be a different story if the caller does not necessarily have a ready access to the_repository, but it is a global, so the caller can pass the_repository and be more explicit. Giving two ways to the caller to express same thing is not a good idea.
Thanks.