From: "Philip Oakley" <philipoakley@iee.org>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "GitList" <git@vger.kernel.org>,
"Johannes Schindelin" <johannes.schindelin@gmx.de>,
"git-for-windows" <git-for-windows@googlegroups.com>
Subject: Re: [PATCH] exec_cmd.c, sideband.c, Makefile: avoid multiple PREFIX definitions
Date: Fri, 6 May 2016 08:23:23 +0100 [thread overview]
Message-ID: <1C7D96C1B53D45CCAA8658C9DBB1AAB5@PhilipOakley> (raw)
In-Reply-To: xmqqk2j89n9y.fsf@gitster.mtv.corp.google.com
From: "Junio C Hamano" <gitster@pobox.com>
> Philip Oakley <philipoakley@iee.org> writes:
>
>> The short and sweet PREFIX can be confused when used in many places.
>>
>> Rename both usages to better describe their purpose.
>>
>> Noticed when compiling Git for Windows using MSVC/Visual Studio which
>> reports the conflict beteeen the command line definition and the
>> definition in sideband.c
>
> Good eyes.
>
>>
>> Signed-off-by: Philip Oakley <philipoakley@iee.org>
>> ---
>> Makefile | 2 +-
>> exec_cmd.c | 4 ++--
>> sideband.c | 6 +++---
>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 33b0f76..bcdd3ec 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1973,7 +1973,7 @@ exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
>> exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
>> '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
>> '-DBINDIR="$(bindir_relative_SQ)"' \
>> - '-DPREFIX="$(prefix_SQ)"'
>> + '-DEXEC_PREFIX="$(prefix_SQ)"'
>
> I am not entirely happy with this name as the name can be easily
> confused with GIT_EXEC_PATH.
>
> This is a fallback used under RUNTIME_PREFIX option, if I am reading
> the code correctly, so the name should hint the linkage between the
> "runtime prefix" mechanism and this variable.
>
> Perhaps RUNTIME_PREFIX_FALLBACK? Used at only two places, that
> should not be an overlong name.
Perhaps EXEC_CMD_PREFIX, for that is what it is? And it's got a 2-way
difference from the GIT_EXEC_PATH. I wasn't seeing it as a fallback, rather
just a different way the OS uses to get to the path. If anything
RUNTIME_PREFIX feels a bit long for a flag.
>
> DISPLAY_PREFIX is OK, as it is an entirely a local thing to
> sideband.c, but with the externally visible PREFIX fixed to be a
> more appropriate name that hints its relation with the "runtime
> prefix" mechanism, it may be better not to even touch it.
>
>> builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
>> builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS =
>> \
>> diff --git a/exec_cmd.c b/exec_cmd.c
>> index 9d5703a..2a79781 100644
>> --- a/exec_cmd.c
>> +++ b/exec_cmd.c
>> @@ -12,7 +12,7 @@ char *system_path(const char *path)
>> #ifdef RUNTIME_PREFIX
>> static const char *prefix;
>> #else
>> - static const char *prefix = PREFIX;
>> + static const char *prefix = EXEC_PREFIX;
>> #endif
>> struct strbuf d = STRBUF_INIT;
>>
>> @@ -27,7 +27,7 @@ char *system_path(const char *path)
>> !(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
>> !(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
>> !(prefix = strip_path_suffix(argv0_path, "git"))) {
>> - prefix = PREFIX;
>> + prefix = EXEC_PREFIX;
>> trace_printf("RUNTIME_PREFIX requested, "
>> "but prefix computation failed. "
>> "Using static fallback '%s'.\n", prefix);
>
next prev parent reply other threads:[~2016-05-06 7:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-05 21:28 [PATCH] Conflicting PREFIX usage Philip Oakley
2016-05-05 21:28 ` [PATCH] exec_cmd.c, sideband.c, Makefile: avoid multiple PREFIX definitions Philip Oakley
2016-05-05 22:02 ` Junio C Hamano
2016-05-06 7:23 ` Philip Oakley [this message]
2016-05-06 16:55 ` Junio C Hamano
2016-05-06 6:18 ` [git-for-windows] " Johannes Sixt
2016-05-06 7:31 ` Philip Oakley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1C7D96C1B53D45CCAA8658C9DBB1AAB5@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git-for-windows@googlegroups.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox