From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Adric Norris <landstander668@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/2] git version --build-options: report the build platform, too
Date: Fri, 8 Dec 2017 18:02:26 +0100 (CET) [thread overview]
Message-ID: <978adf12e85ec6c4d407ba09da82945a08ee1f8c.1512752468.git.johannes.schindelin@gmx.de> (raw)
In-Reply-To: <cover.1512752468.git.johannes.schindelin@gmx.de>
From: Adric Norris <landstander668@gmail.com>
When asking for bug reports to include the output of `git version
--build-options`, the idea is that we get a better idea of the
environment where said bug occurs. In this context, it is useful to
distinguish between 32 and 64-bit builds.
We start by distinguishing between x86 and x86_64 (hoping that
interested parties will extend this to other architectures in the
future). In addition, all 32-bit variants (i686, i586, etc.) are
collapsed into `x86'. An example of the output is:
$ git version --build-options
git version 2.9.3.windows.2.826.g06c0f2f
sizeof-long: 4
machine: x86_64
The label of `machine' was chosen so the new information will approximate
the output of `uname -m'.
Signed-off-by: Adric Norris <landstander668@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
help.c | 2 ++
help.h | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/help.c b/help.c
index 88a3aeaeb9f..df1332fa3c9 100644
--- a/help.c
+++ b/help.c
@@ -390,6 +390,7 @@ const char *help_unknown_cmd(const char *cmd)
int cmd_version(int argc, const char **argv, const char *prefix)
{
+ static char build_platform[] = GIT_BUILD_PLATFORM;
int build_options = 0;
const char * const usage[] = {
N_("git version [<options>]"),
@@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
if (build_options) {
printf("sizeof-long: %d\n", (int)sizeof(long));
+ printf("machine: %s\n", build_platform);
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
}
return 0;
diff --git a/help.h b/help.h
index b21d7c94e8c..42dd9852194 100644
--- a/help.h
+++ b/help.h
@@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru
*/
extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);
#endif /* HELP_H */
+
+/*
+ * identify build platform
+ */
+#ifndef GIT_BUILD_PLATFORM
+ #if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__
+ #define GIT_BUILD_PLATFORM "x86"
+ #elif defined __x86_64__
+ #define GIT_BUILD_PLATFORM "x86_64"
+ #else
+ #define GIT_BUILD_PLATFORM "unknown"
+ #endif
+#endif
--
2.15.1.windows.2
next prev parent reply other threads:[~2017-12-08 17:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 17:01 [PATCH 0/2] Offer more information in `git version --build-options`'s output Johannes Schindelin
2017-12-08 17:02 ` Johannes Schindelin [this message]
2017-12-08 17:23 ` [PATCH 1/2] git version --build-options: report the build platform, too Jonathan Nieder
2017-12-08 17:43 ` Junio C Hamano
2017-12-08 21:17 ` Eric Sunshine
2017-12-08 21:19 ` Eric Sunshine
2017-12-09 9:43 ` Eric Sunshine
2017-12-09 14:17 ` Johannes Schindelin
2017-12-08 17:02 ` [PATCH 2/2] version --build-options: report commit, too, if possible Johannes Schindelin
2017-12-08 17:27 ` Jonathan Nieder
2017-12-08 17:49 ` Junio C Hamano
2017-12-14 23:27 ` Johannes Schindelin
2017-12-14 23:25 ` Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 0/2] Offer more information in `git version --build-options`'s output Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 1/2] version --build-options: also report host CPU Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 2/2] version --build-options: report commit, too, if possible Johannes Schindelin
2017-12-15 17:45 ` [PATCH v2 0/2] Offer more information in `git version --build-options`'s output Junio C Hamano
2017-12-15 18:03 ` Eric Sunshine
2017-12-15 18:12 ` Junio C Hamano
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=978adf12e85ec6c4d407ba09da82945a08ee1f8c.1512752468.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=landstander668@gmail.com \
/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).