From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Philip Oakley <philipoakley@iee.org>,
Junio C Hamano <gitster@pobox.com>, Dan Jacques <dnj@google.com>
Subject: [PATCH 3/3] Avoid multiple PREFIX definitions
Date: Fri, 20 Apr 2018 10:04:12 +0200 (DST) [thread overview]
Message-ID: <d134afdd22c9cdfd763213b37efac4ef0399a374.1524211375.git.johannes.schindelin@gmx.de> (raw)
In-Reply-To: <cover.1524211375.git.johannes.schindelin@gmx.de>
From: Philip Oakley <philipoakley@iee.org>
The short and sweet PREFIX can be confused when used in many places.
Rename both usages to better describe their purpose. EXEC_CMD_PREFIX is
used in full to disambiguate it from the nearby GIT_EXEC_PATH.
The PREFIX in sideband.c, while nominally independant of the exec_cmd
PREFIX, does reside within libgit[1], so the definitions would clash
when taken together with a PREFIX given on the command line for use by
exec_cmd.c.
Noticed when compiling Git for Windows using MSVC/Visual Studio [1] which
reports the conflict beteeen the command line definition and the
definition in sideband.c within the libgit project.
[1] the libgit functions are brought into a single sub-project
within the Visual Studio construction script provided in contrib,
and hence uses a single command for both exec_cmd.c and sideband.c.
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Makefile | 2 +-
exec-cmd.c | 4 ++--
sideband.c | 10 +++++-----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index 111e93d3bea..49cec672242 100644
--- a/Makefile
+++ b/Makefile
@@ -2271,7 +2271,7 @@ exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
'-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \
- '-DPREFIX="$(prefix_SQ)"'
+ '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
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 3b0a039083a..02d31ee8971 100644
--- a/exec-cmd.c
+++ b/exec-cmd.c
@@ -48,7 +48,7 @@ static const char *system_prefix(void)
!(prefix = strip_path_suffix(executable_dirname, GIT_EXEC_PATH)) &&
!(prefix = strip_path_suffix(executable_dirname, BINDIR)) &&
!(prefix = strip_path_suffix(executable_dirname, "git"))) {
- prefix = PREFIX;
+ prefix = FALLBACK_RUNTIME_PREFIX;
trace_printf("RUNTIME_PREFIX requested, "
"but prefix computation failed. "
"Using static fallback '%s'.\n", prefix);
@@ -243,7 +243,7 @@ void git_resolve_executable_dir(const char *argv0)
*/
static const char *system_prefix(void)
{
- return PREFIX;
+ return FALLBACK_RUNTIME_PREFIX;
}
/*
diff --git a/sideband.c b/sideband.c
index 6d7f943e438..325bf0e974a 100644
--- a/sideband.c
+++ b/sideband.c
@@ -13,7 +13,7 @@
* the remote died unexpectedly. A flush() concludes the stream.
*/
-#define PREFIX "remote: "
+#define DISPLAY_PREFIX "remote: "
#define ANSI_SUFFIX "\033[K"
#define DUMB_SUFFIX " "
@@ -49,7 +49,7 @@ int recv_sideband(const char *me, int in_stream, int out)
switch (band) {
case 3:
strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "",
- PREFIX, buf + 1);
+ DISPLAY_PREFIX, buf + 1);
retval = SIDEBAND_REMOTE_ERROR;
break;
case 2:
@@ -67,7 +67,7 @@ int recv_sideband(const char *me, int in_stream, int out)
int linelen = brk - b;
if (!outbuf.len)
- strbuf_addstr(&outbuf, PREFIX);
+ strbuf_addstr(&outbuf, DISPLAY_PREFIX);
if (linelen > 0) {
strbuf_addf(&outbuf, "%.*s%s%c",
linelen, b, suffix, *brk);
@@ -81,8 +81,8 @@ int recv_sideband(const char *me, int in_stream, int out)
}
if (*b)
- strbuf_addf(&outbuf, "%s%s",
- outbuf.len ? "" : PREFIX, b);
+ strbuf_addf(&outbuf, "%s%s", outbuf.len ?
+ "" : DISPLAY_PREFIX, b);
break;
case 1:
write_or_die(out, buf + 1, len);
--
2.17.0.windows.1.15.gaa56ade3205
next prev parent reply other threads:[~2018-04-20 8:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 8:03 [PATCH 0/3] Some add-on patches on top of dj/runtime-prefix Johannes Schindelin
2018-04-20 8:03 ` [PATCH 1/3] gettext: avoid initialization if the locale dir is not present Johannes Schindelin
2018-04-20 9:59 ` Ævar Arnfjörð Bjarmason
2018-04-20 10:54 ` Martin Ågren
2018-04-20 11:18 ` Ævar Arnfjörð Bjarmason
2018-04-20 19:35 ` Johannes Schindelin
2018-04-21 7:43 ` Ævar Arnfjörð Bjarmason
2018-04-21 10:17 ` Johannes Schindelin
2018-04-20 8:03 ` [PATCH 2/3] git_setup_gettext: plug memory leak Johannes Schindelin
2018-04-20 8:04 ` Johannes Schindelin [this message]
2018-04-22 15:32 ` [PATCH 3/3] Avoid multiple PREFIX definitions Philip Oakley
2018-04-21 11:13 ` [PATCH v2 0/3] Some add-on patches on top of dj/runtime-prefix Johannes Schindelin
2018-04-21 11:14 ` [PATCH v2 1/3] gettext: avoid initialization if the locale dir is not present Johannes Schindelin
2018-04-21 11:14 ` [PATCH v2 2/3] git_setup_gettext: plug memory leak Johannes Schindelin
2018-04-21 11:18 ` [PATCH v2 3/3] Avoid multiple PREFIX definitions Johannes Schindelin
2018-04-24 1:44 ` [PATCH v2 0/3] Some add-on patches on top of dj/runtime-prefix Junio C Hamano
2018-04-24 1:50 ` Junio C Hamano
2018-04-24 2:41 ` Junio C Hamano
2018-04-24 14:48 ` Johannes Schindelin
2018-04-25 1:28 ` Junio C Hamano
2018-04-25 7:46 ` Johannes Schindelin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d134afdd22c9cdfd763213b37efac4ef0399a374.1524211375.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=dnj@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=philipoakley@iee.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).