Re: [PATCH 07/12] fsmonitor: prepare to share code between Mac OS and Linux
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 9, 2022, 22:36 UTC
- Message-ID
- <xmqqh70c62w0.fsf@gitster.g>
- In-Reply-To
- <c085fc15b314abcb5e5ca6b4ee5ac54a28327cab.1665326258.git.gitgitgadget@gmail.com>
"Eric DeCosta via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> diff --git a/Makefile b/Makefile > index feb675a6959..31dd6ab2734 100644 > --- a/Makefile > +++ b/Makefile > @@ -2038,13 +2038,13 @@ endif > ifdef FSMONITOR_DAEMON_BACKEND > COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND > COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o > - COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o > - COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o > + COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_COMMON).o > + COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_COMMON).o > endif > > ifdef FSMONITOR_OS_SETTINGS > COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS > - COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o > + COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_COMMON).o > COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o > endif
These two look sloppier than the existing "if we have DAEMON_BACKEND defined, then add $(DAEMON_BACKEND).o to the set of objects used". $(DAEMON_COMMON).o should be used after the same kind of check, i.e.
+ifdef FSMONITOR_DAEMON_COMMON + COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_COMMON).o + COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_COMMON).o + COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_DAEMON_COMMON).o +endif
as a separate if/endif block, without touching the above two, perhaps?
Show 23 quoted lines
> --- a/compat/fsmonitor/fsm-ipc-darwin.c
> +++ b/compat/fsmonitor/fsm-ipc-unix.c
> @@ -10,7 +10,7 @@ static GIT_PATH_FUNC(fsmonitor_ipc__get_default_path, "fsmonitor--daemon.ipc")
> const char *fsmonitor_ipc__get_path(struct repository *r)
> {
> static const char *ipc_path = NULL;
> - SHA_CTX sha1ctx;
> + git_SHA_CTX sha1ctx;
> char *sock_dir = NULL;
> struct strbuf ipc_file = STRBUF_INIT;
> unsigned char hash[SHA_DIGEST_LENGTH];
> @@ -28,9 +28,9 @@ const char *fsmonitor_ipc__get_path(struct repository *r)
> return ipc_path;
> }
>
> - SHA1_Init(&sha1ctx);
> - SHA1_Update(&sha1ctx, r->worktree, strlen(r->worktree));
> - SHA1_Final(hash, &sha1ctx);
> + git_SHA1_Init(&sha1ctx);
> + git_SHA1_Update(&sha1ctx, r->worktree, strlen(r->worktree));
> + git_SHA1_Final(hash, &sha1ctx);
>
> repo_config_get_string(r, "fsmonitor.socketdir", &sock_dir);Interesting. The result of course is good, but I wonder how we have been happy to queue the original code that lack git_ prefix in the first place X-<.
Show 12 quoted lines
> diff --git a/config.mak.uname b/config.mak.uname > index d63629fe807..d454cec47c4 100644 > --- a/config.mak.uname > +++ b/config.mak.uname > @@ -68,6 +68,7 @@ ifeq ($(uname_S),Linux) > ifneq ($(findstring .el7.,$(uname_R)),) > BASIC_CFLAGS += -std=c99 > endif > + > endif > ifeq ($(uname_S),GNU/kFreeBSD) > HAVE_ALLOCA_H = YesPlease
That's a new blank line in an unexpected place. Did you mean to add it after the outer endif?