Re: [PATCH v2 1/3] run-command: conditionally define locate_in_PATH()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 4, 2023, 04:23 UTC
- Message-ID
- <xmqqo7jn3073.fsf@gitster.g>
- In-Reply-To
- <dc9c0812d203a4eb777659bb54fda60022bf9650.1691122124.git.gitgitgadget@gmail.com>
"Matthias Aßhauer via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 23 quoted lines
> From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de> > > This commit doesn't change any behaviour by itself, but allows us to easily > define compat replacements for locate_in_PATH(). It prepares us for the next > commit that adds a native Windows implementation of locate_in_PATH(). > > Signed-off-by: Matthias Aßhauer <mha1993@live.de> > --- > run-command.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/run-command.c b/run-command.c > index 60c94198664..85fc1507288 100644 > --- a/run-command.c > +++ b/run-command.c > @@ -170,6 +170,7 @@ int is_executable(const char *name) > return st.st_mode & S_IXUSR; > } > > +#ifndef locate_in_PATH > /* > * Search $PATH for a command. This emulates the path search that > * execvp would perform, without actually executing the command so it
Micronit. The comment should be shared across different platform implementations of this interface, so "#ifndef" would want to come immediately after this comment, not before, I would think.
It does not affect the correctness, of course ;-)
Show 8 quoted lines
> @@ -218,6 +219,7 @@ static char *locate_in_PATH(const char *file)
> strbuf_release(&buf);
> return NULL;
> }
> +#endif
>
> int exists_in_PATH(const char *command)
> {