{"thread":{"id":"47412","subject":"[PATCH 0/2] Offer more information in `git version --build-options`'s output","startedAt":"2017-12-08T17:02:20Z","lastAt":"2017-12-15T18:12:39Z","messageCount":19,"participants":["Johannes Schindelin","Jonathan Nieder","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"334455","messageId":"cover.1512752468.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":null,"subject":"[PATCH 0/2] Offer more information in `git version --build-options`'s output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-08T17:01:46Z","receivedAt":"2017-12-08T17:02:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"In Git for Windows, we ask users to paste the output of said command\ninto their bug reports, with the idea that this frequently helps\nidentify where the problems are coming from.\n\nThere are some obvious missing bits of information in said output,\nthough, and this patch series tries to fill the gaps at least a little.\n\n\nAdric Norris (1):\n  git version --build-options: report the build platform, too\n\nJohannes Schindelin (1):\n  version --build-options: report commit, too, if possible\n\n Makefile  |  4 +++-\n help.c    |  4 ++++\n help.h    | 13 +++++++++++++\n version.c |  1 +\n version.h |  1 +\n 5 files changed, 22 insertions(+), 1 deletion(-)\n\n\nbase-commit: 95ec6b1b3393eb6e26da40c565520a8db9796e9f\nPublished-As: https://github.com/dscho/git/releases/tag/built-from-commit-v1\nFetch-It-Via: git fetch https://github.com/dscho/git built-from-commit-v1\n-- \n2.15.1.windows.2\n\n"},{"id":"334456","messageId":"978adf12e85ec6c4d407ba09da82945a08ee1f8c.1512752468.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":"cover.1512752468.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-08T17:02:26Z","receivedAt":"2017-12-08T17:02:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Adric Norris <landstander668@gmail.com>\n\nWhen asking for bug reports to include the output of `git version\n--build-options`, the idea is that we get a better idea of the\nenvironment where said bug occurs. In this context, it is useful to\ndistinguish between 32 and 64-bit builds.\n\nWe start by distinguishing between x86 and x86_64 (hoping that\ninterested parties will extend this to other architectures in the\nfuture).  In addition, all 32-bit variants (i686, i586, etc.) are\ncollapsed into `x86'. An example of the output is:\n\n   $ git version --build-options\n   git version 2.9.3.windows.2.826.g06c0f2f\n   sizeof-long: 4\n   machine: x86_64\n\nThe label of `machine' was chosen so the new information will approximate\nthe output of `uname -m'.\n\nSigned-off-by: Adric Norris <landstander668@gmail.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n help.c |  2 ++\n help.h | 13 +++++++++++++\n 2 files changed, 15 insertions(+)\n\ndiff --git a/help.c b/help.c\nindex 88a3aeaeb9f..df1332fa3c9 100644\n--- a/help.c\n+++ b/help.c\n@@ -390,6 +390,7 @@ const char *help_unknown_cmd(const char *cmd)\n \n int cmd_version(int argc, const char **argv, const char *prefix)\n {\n+\tstatic char build_platform[] = GIT_BUILD_PLATFORM;\n \tint build_options = 0;\n \tconst char * const usage[] = {\n \t\tN_(\"git version [<options>]\"),\n@@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n \n \tif (build_options) {\n \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n+\t\tprintf(\"machine: %s\\n\", build_platform);\n \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n \t}\n \treturn 0;\ndiff --git a/help.h b/help.h\nindex b21d7c94e8c..42dd9852194 100644\n--- a/help.h\n+++ b/help.h\n@@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru\n  */\n extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);\n #endif /* HELP_H */\n+\n+/*\n+ * identify build platform\n+ */\n+#ifndef GIT_BUILD_PLATFORM\n+\t#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__\n+\t\t#define GIT_BUILD_PLATFORM \"x86\"\n+\t#elif defined __x86_64__\n+\t\t#define GIT_BUILD_PLATFORM \"x86_64\"\n+\t#else\n+\t\t#define GIT_BUILD_PLATFORM \"unknown\"\n+\t#endif\n+#endif\n-- \n2.15.1.windows.2\n\n\n"},{"id":"334457","messageId":"908989103a06291e38c8551c447bc73eb781fb26.1512752468.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":"cover.1512752468.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/2] version --build-options: report commit, too, if possible","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-08T17:02:31Z","receivedAt":"2017-12-08T17:02:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"In particular when local tags are used (or tags that are pushed to some\nfork) to build Git, it is very hard to figure out from which particular\nrevision a particular Git executable was built.\n\nLet's just report that in our build options.\n\nWe need to be careful, though, to report when the current commit cannot be\ndetermined, e.g. when building from a tarball without any associated Git\nrepository.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n Makefile  | 4 +++-\n help.c    | 2 ++\n version.c | 1 +\n version.h | 1 +\n 4 files changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex fef9c8d2725..92a0ae3d8e3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1893,7 +1893,9 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \\\n version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT\n version.sp version.s version.o: EXTRA_CPPFLAGS = \\\n \t'-DGIT_VERSION=\"$(GIT_VERSION)\"' \\\n-\t'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'\n+\t'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \\\n+\t'-DGIT_BUILT_FROM_COMMIT=\"$(shell git rev-parse -q --verify HEAD || \\\n+\t\techo \"(unknown)\")\"'\n \n $(BUILT_INS): git$X\n \t$(QUIET_BUILT_IN)$(RM) $@ && \\\ndiff --git a/help.c b/help.c\nindex df1332fa3c9..6ebea665780 100644\n--- a/help.c\n+++ b/help.c\n@@ -413,6 +413,8 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n \tprintf(\"git version %s\\n\", git_version_string);\n \n \tif (build_options) {\n+\t\tprintf(\"built from commit: %s\\n\",\n+\t\t       git_built_from_commit_string);\n \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n \t\tprintf(\"machine: %s\\n\", build_platform);\n \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\ndiff --git a/version.c b/version.c\nindex 6106a8098c8..41b718c29e1 100644\n--- a/version.c\n+++ b/version.c\n@@ -3,6 +3,7 @@\n #include \"strbuf.h\"\n \n const char git_version_string[] = GIT_VERSION;\n+const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;\n \n const char *git_user_agent(void)\n {\ndiff --git a/version.h b/version.h\nindex 6911a4f1558..7c62e805771 100644\n--- a/version.h\n+++ b/version.h\n@@ -2,6 +2,7 @@\n #define VERSION_H\n \n extern const char git_version_string[];\n+extern const char git_built_from_commit_string[];\n \n const char *git_user_agent(void);\n const char *git_user_agent_sanitized(void);\n-- \n2.15.1.windows.2\n"},{"id":"334459","messageId":"20171208172324.GB14261@aiede.mtv.corp.google.com","threadId":"47412","inReplyTo":"978adf12e85ec6c4d407ba09da82945a08ee1f8c.1512752468.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-12-08T17:23:24Z","receivedAt":"2017-12-08T17:23:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJohannes Schindelin wrote:\n\n> From: Adric Norris <landstander668@gmail.com>\n>\n> When asking for bug reports to include the output of `git version\n> --build-options`, the idea is that we get a better idea of the\n> environment where said bug occurs. In this context, it is useful to\n> distinguish between 32 and 64-bit builds.\n\nNeat!\n\nThe cover letter gives a clearer idea of the motivation:\n\n\tIn Git for Windows, we ask users to paste the output of said command\n\tinto their bug reports, with the idea that this frequently helps\n\tidentify where the problems are coming from.\n\n\tThere are some obvious missing bits of information in said output,\n\tthough, and this patch series tries to fill the gaps at least a little.\n\nCould some of that text go here, too?\n\n[...]\n> --- a/help.c\n> +++ b/help.c\n> @@ -390,6 +390,7 @@ const char *help_unknown_cmd(const char *cmd)\n>  \n>  int cmd_version(int argc, const char **argv, const char *prefix)\n>  {\n> +\tstatic char build_platform[] = GIT_BUILD_PLATFORM;\n>  \tint build_options = 0;\n>  \tconst char * const usage[] = {\n>  \t\tN_(\"git version [<options>]\"),\n> @@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n>  \n>  \tif (build_options) {\n>  \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n> +\t\tprintf(\"machine: %s\\n\", build_platform);\n\nCan this use GIT_BUILD_PLATFORM directly instead of going via the indirection\nof a mutable static string?  That is, something like\n\n\t\tprintf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n\n>  \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n\nWhat do you think of this idea?  uname_M isn't one of the variables\nin that file, though, so that's orthogonal to this patch.\n\n[...]\n> --- a/help.h\n> +++ b/help.h\n> @@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru\n>   */\n>  extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);\n>  #endif /* HELP_H */\n> +\n> +/*\n> + * identify build platform\n> + */\n> +#ifndef GIT_BUILD_PLATFORM\n> +\t#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__\n> +\t\t#define GIT_BUILD_PLATFORM \"x86\"\n> +\t#elif defined __x86_64__\n> +\t\t#define GIT_BUILD_PLATFORM \"x86_64\"\n> +\t#else\n> +\t\t#define GIT_BUILD_PLATFORM \"unknown\"\n> +\t#endif\n> +#endif\n\nThis code needs to be inside the HELP_H header guard.\n\nThanks and hope that helps,\nJonathan\n"},{"id":"334460","messageId":"20171208172733.GC14261@aiede.mtv.corp.google.com","threadId":"47412","inReplyTo":"908989103a06291e38c8551c447bc73eb781fb26.1512752468.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 2/2] version --build-options: report commit, too, if possible","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-12-08T17:27:33Z","receivedAt":"2017-12-08T17:27:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJohannes Schindelin wrote:\n\n> In particular when local tags are used (or tags that are pushed to some\n> fork) to build Git, it is very hard to figure out from which particular\n> revision a particular Git executable was built.\n\nHm, can you say more about how this comes up in practice?  I wonder if\nwe should always augment the version string with the commit hash.\nE.g. I am running\n\n\tgit version 2.15.1.424.g9478a66081\n\nnow, which already includes the commit hash because it disambiguates\nthe .424 thing, but depending on the motivation, maybe we would also\nwant\n\n\tgit version 2.15.1.0.g9b185bef0c15\n\nfor people running v2.15.1 (or at least when such a tag is not a well\nknown, published tag).\n\n> We need to be careful, though, to report when the current commit cannot be\n> determined, e.g. when building from a tarball without any associated Git\n> repository.\n\nThis means that on Debian, it would always print\n\n\tbuilt from commit: (unknown)\n\nMaybe I shouldn't care, but I wonder if there's a way to improve on\nthat. E.g. should there be a makefile knob to allow Debian to specify\nwhat to put there?\n\nThanks,\nJonathan\n"},{"id":"334465","messageId":"xmqq374l9kti.fsf@gitster.mtv.corp.google.com","threadId":"47412","inReplyTo":"20171208172324.GB14261@aiede.mtv.corp.google.com","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-08T17:43:53Z","receivedAt":"2017-12-08T17:44:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> @@ -390,6 +390,7 @@ const char *help_unknown_cmd(const char *cmd)\n>>  \n>>  int cmd_version(int argc, const char **argv, const char *prefix)\n>>  {\n>> +\tstatic char build_platform[] = GIT_BUILD_PLATFORM;\n>>  \tint build_options = 0;\n>>  \tconst char * const usage[] = {\n>>  \t\tN_(\"git version [<options>]\"),\n>> @@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n>>  \n>>  \tif (build_options) {\n>>  \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n>> +\t\tprintf(\"machine: %s\\n\", build_platform);\n>\n> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection\n> of a mutable static string?  That is, something like\n>\n> \t\tprintf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n\nGood point.  And if this is externally identified as \"machine\",\nprobably the macro should also use the same word, not \"platform\".\nWe can go either way, as long as we are consistent, though.\n\n>> --- a/help.h\n>> +++ b/help.h\n>> @@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru\n>>   */\n>>  extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);\n>>  #endif /* HELP_H */\n>> +\n>> +/*\n>> + * identify build platform\n>> + */\n>> +#ifndef GIT_BUILD_PLATFORM\n>> +\t#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__\n>> +\t\t#define GIT_BUILD_PLATFORM \"x86\"\n>> +\t#elif defined __x86_64__\n>> +\t\t#define GIT_BUILD_PLATFORM \"x86_64\"\n>> +\t#else\n>> +\t\t#define GIT_BUILD_PLATFORM \"unknown\"\n>> +\t#endif\n>> +#endif\n>\n> This code needs to be inside the HELP_H header guard.\n\nCertainly.\n\nThanks.\n"},{"id":"334468","messageId":"xmqqy3md85zh.fsf@gitster.mtv.corp.google.com","threadId":"47412","inReplyTo":"20171208172733.GC14261@aiede.mtv.corp.google.com","subject":"Re: [PATCH 2/2] version --build-options: report commit, too, if possible","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-08T17:49:38Z","receivedAt":"2017-12-08T17:49:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> We need to be careful, though, to report when the current commit cannot be\n>> determined, e.g. when building from a tarball without any associated Git\n>> repository.\n>\n> This means that on Debian, it would always print\n>\n> \tbuilt from commit: (unknown)\n>\n> Maybe I shouldn't care, but I wonder if there's a way to improve on\n> that. E.g. should there be a makefile knob to allow Debian to specify\n> what to put there?\n\nAnother \"interesting\" possibility is to build from a tarball\nextracted into a directory hierarchy that is controlled by an\nunrelated Git repository.  E.g. \"my $HOME is under $HOME/.git\nrepository, and then I have a tarball extract in $HOME/src/git\".\nWe shouldn't embed the HEAD commit of that $HOME directory project\nin the resulting executable in such a case.\n\nWe should be able to do this by being a bit more careful than the\npresented patch.  Make sure that the toplevel is at the same\ndirectory as we assumed to be (i.e. where we found that Makefile)\nand trust rev-parse output only when that is the case, or something\nlike that.\n"},{"id":"334503","messageId":"CAPig+cRrVRJ+H7c5Q3zLj6gjPegLFQmngGtiezgxTBTDqWSj0g@mail.gmail.com","threadId":"47412","inReplyTo":"xmqq374l9kti.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-08T21:17:05Z","receivedAt":"2017-12-08T21:17:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Dec 8, 2017 at 12:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>>> @@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n>>>\n>>>      if (build_options) {\n>>>              printf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n>>> +            printf(\"machine: %s\\n\", build_platform);\n>>\n>> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection\n>> of a mutable static string?  That is, something like\n>>\n>>               printf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n>\n> Good point.  And if this is externally identified as \"machine\",\n> probably the macro should also use the same word, not \"platform\".\n> We can go either way, as long as we are consistent, though.\n\nIn Autoconf parlance, this would be called \"host architecture\" (GIT_HOST_ARCH).\n"},{"id":"334505","messageId":"CAPig+cTq1LgRK_jXgLn+VY_qtDAJ27Ja-Uf-NwdG2g=tv9c=Yg@mail.gmail.com","threadId":"47412","inReplyTo":"CAPig+cRrVRJ+H7c5Q3zLj6gjPegLFQmngGtiezgxTBTDqWSj0g@mail.gmail.com","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-08T21:19:25Z","receivedAt":"2017-12-08T21:19:33Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Dec 8, 2017 at 4:17 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Fri, Dec 8, 2017 at 12:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jonathan Nieder <jrnieder@gmail.com> writes:\n>>>> @@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n>>>>\n>>>>      if (build_options) {\n>>>>              printf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n>>>> +            printf(\"machine: %s\\n\", build_platform);\n>>>\n>>> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection\n>>> of a mutable static string?  That is, something like\n>>>\n>>>               printf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n>>\n>> Good point.  And if this is externally identified as \"machine\",\n>> probably the macro should also use the same word, not \"platform\".\n>> We can go either way, as long as we are consistent, though.\n>\n> In Autoconf parlance, this would be called \"host architecture\" (GIT_HOST_ARCH).\n\nMy bad: \"host cpu\", rather (GIT_HOST_CPU).\n"},{"id":"334533","messageId":"20171209094310.GA60808@flurp.local","threadId":"47412","inReplyTo":"CAPig+cTq1LgRK_jXgLn+VY_qtDAJ27Ja-Uf-NwdG2g=tv9c=Yg@mail.gmail.com","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-09T09:43:10Z","receivedAt":"2017-12-09T09:43:36Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Dec 08, 2017 at 04:19:25PM -0500, Eric Sunshine wrote:\n> On Fri, Dec 8, 2017 at 4:17 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > On Fri, Dec 8, 2017 at 12:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> >> Jonathan Nieder <jrnieder@gmail.com> writes:\n> >>> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection\n> >>> of a mutable static string?  That is, something like\n> >>>\n> >>>               printf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n> >>\n> >> Good point.  And if this is externally identified as \"machine\",\n> >> probably the macro should also use the same word, not \"platform\".\n> >> We can go either way, as long as we are consistent, though.\n> >\n> > In Autoconf parlance, this would be called \"host architecture\" (GIT_HOST_ARCH).\n> \n> My bad: \"host cpu\", rather (GIT_HOST_CPU).\n\nDscho, when you re-roll, perhaps replace the current patch with the\none below which determines the CPU type automatically rather than\nhaving to manually maintain and augment a bunch of #ifdefs in help.h.\n\nI took the liberty of renaming the #define to GIT_HOST_CPU to better\nmatch Autoconf parlance since its conceivable that Git might some day\nsupport cross-compilation officially via the configure script (which\ndoesn't yet work, though I have some patches which begin addressing\nthat, but that's a separate topic).\n\nThe original plan was to keep Adric Norris as author, but by the time\nthe patch was done and the commit message rewritten to match, I\nrealized that none of his work remained, thus ended up dropping his\nauthorship and both of your sign-offs. Sorry.\n\n--- >8 ---\nFrom: Eric Sunshine <sunshine@sunshineco.com>\nDate: Sat, 9 Dec 2017 04:09:18 -0500\nSubject: [PATCH] help: version --build-options: also report host CPU\n\nIt can be helpful for bug reports to include information about the\nenvironment in which the bug occurs. \"git version --build-options\" can\nhelp to supplement this information. In addition to the size of 'long'\nalready reported by --build-options, also report the host's CPU type.\nExample output:\n\n   $ git version --build-options\n   git version 2.9.3.windows.2.826.g06c0f2f\n   cpu: x86_64\n   sizeof-long: 4\n\nNew Makefile variable HOST_CPU supports cross-compiling.\n\nSuggested-by: Adric Norris <landstander668@gmail.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n Makefile | 9 +++++++++\n help.c   | 1 +\n 2 files changed, 10 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex fef9c8d272..5587bccc93 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -425,6 +425,9 @@ all::\n #\n # to say \"export LESS=FRX (and LV=-c) if the environment variable\n # LESS (and LV) is not set, respectively\".\n+#\n+# When cross-compiling, define HOST_CPU as the canonical name of the CPU on\n+# which the built Git will run (for instance \"x86_64\").\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -1095,6 +1098,12 @@ else\n BROKEN_PATH_FIX = '/^\\# @@BROKEN_PATH_FIX@@$$/d'\n endif\n \n+ifeq (,$(HOST_CPU))\n+\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(firstword $(subst -, ,$(uname_M)))\\\"\"\n+else\n+\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(HOST_CPU)\\\"\"\n+endif\n+\n ifneq (,$(INLINE))\n \tBASIC_CFLAGS += -Dinline=$(INLINE)\n endif\ndiff --git a/help.c b/help.c\nindex 88a3aeaeb9..cbcb159f36 100644\n--- a/help.c\n+++ b/help.c\n@@ -412,6 +412,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n \tprintf(\"git version %s\\n\", git_version_string);\n \n \tif (build_options) {\n+\t\tprintf(\"cpu: %s\\n\", GIT_HOST_CPU);\n \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n \t}\n-- \n2.15.1.502.gccaef8de57\n\n"},{"id":"334541","messageId":"alpine.DEB.2.21.1.1712091517240.4318@virtualbox","threadId":"47412","inReplyTo":"20171209094310.GA60808@flurp.local","subject":"Re: [PATCH 1/2] git version --build-options: report the build platform, too","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-09T14:17:40Z","receivedAt":"2017-12-09T14:17:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Eric,\n\nOn Sat, 9 Dec 2017, Eric Sunshine wrote:\n\n> On Fri, Dec 08, 2017 at 04:19:25PM -0500, Eric Sunshine wrote:\n> > On Fri, Dec 8, 2017 at 4:17 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > > On Fri, Dec 8, 2017 at 12:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> > >> Jonathan Nieder <jrnieder@gmail.com> writes:\n> > >>> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection\n> > >>> of a mutable static string?  That is, something like\n> > >>>\n> > >>>               printf(\"machine: %s\\n\", GIT_BUILD_PLATFORM);\n> > >>\n> > >> Good point.  And if this is externally identified as \"machine\",\n> > >> probably the macro should also use the same word, not \"platform\".\n> > >> We can go either way, as long as we are consistent, though.\n> > >\n> > > In Autoconf parlance, this would be called \"host architecture\" (GIT_HOST_ARCH).\n> > \n> > My bad: \"host cpu\", rather (GIT_HOST_CPU).\n> \n> Dscho, when you re-roll, perhaps replace the current patch with the\n> one below which determines the CPU type automatically rather than\n> having to manually maintain and augment a bunch of #ifdefs in help.h.\n\nWill do!\n\nCiao,\nDscho\n"},{"id":"334858","messageId":"alpine.DEB.2.21.1.1712150020400.406@MININT-6BKU6QN.europe.corp.microsoft.com","threadId":"47412","inReplyTo":"20171208172733.GC14261@aiede.mtv.corp.google.com","subject":"Re: [PATCH 2/2] version --build-options: report commit, too, if possible","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-14T23:25:56Z","receivedAt":"2017-12-14T23:26:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Jonathan,\n\nOn Fri, 8 Dec 2017, Jonathan Nieder wrote:\n\n> Johannes Schindelin wrote:\n> \n> > In particular when local tags are used (or tags that are pushed to some\n> > fork) to build Git, it is very hard to figure out from which particular\n> > revision a particular Git executable was built.\n> \n> Hm, can you say more about how this comes up in practice?\n\nI recently saw a version string on this here list (in a generated patch)\nthat looked something like \"git v2.14.0.chrome\".\n\nI sometimes build custom Git for Windows snapshots from commits that I\nkeep in my own fork. I would expect other people to do the same.\n\nWith this patch, at least I can verify very easily whether I have access\nto the corresponding commit or not.\n\n> I wonder if we should always augment the version string with the commit\n> hash.\n\nThat would probably be more confusing than helpful to the end-users.\n\n> E.g. I am running\n> \n> \tgit version 2.15.1.424.g9478a66081\n\nwhich is currently good enough, but in the future may clash with another\nobject, maybe even a commit. Unabbreviated commit names are what I am\nafter.\n\n> > We need to be careful, though, to report when the current commit cannot be\n> > determined, e.g. when building from a tarball without any associated Git\n> > repository.\n> \n> This means that on Debian, it would always print\n> \n> \tbuilt from commit: (unknown)\n> \n> Maybe I shouldn't care, but I wonder if there's a way to improve on\n> that. E.g. should there be a makefile knob to allow Debian to specify\n> what to put there?\n\nI changed the text to \"no commit associated with this build\". Does that\nsuffice? If not, what \"UI\" would you suggest (most likely a new Makefile\nvariable? What name would you prefer?).\n\nCiao,\nDscho\n"},{"id":"334859","messageId":"alpine.DEB.2.21.1.1712150027360.406@MININT-6BKU6QN.europe.corp.microsoft.com","threadId":"47412","inReplyTo":"xmqqy3md85zh.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] version --build-options: report commit, too, if possible","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-14T23:27:57Z","receivedAt":"2017-12-14T23:28:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Fri, 8 Dec 2017, Junio C Hamano wrote:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n> \n> >> We need to be careful, though, to report when the current commit cannot be\n> >> determined, e.g. when building from a tarball without any associated Git\n> >> repository.\n> >\n> > This means that on Debian, it would always print\n> >\n> > \tbuilt from commit: (unknown)\n> >\n> > Maybe I shouldn't care, but I wonder if there's a way to improve on\n> > that. E.g. should there be a makefile knob to allow Debian to specify\n> > what to put there?\n> \n> Another \"interesting\" possibility is to build from a tarball\n> extracted into a directory hierarchy that is controlled by an\n> unrelated Git repository.  E.g. \"my $HOME is under $HOME/.git\n> repository, and then I have a tarball extract in $HOME/src/git\".\n> We shouldn't embed the HEAD commit of that $HOME directory project\n> in the resulting executable in such a case.\n> \n> We should be able to do this by being a bit more careful than the\n> presented patch.  Make sure that the toplevel is at the same\n> directory as we assumed to be (i.e. where we found that Makefile)\n> and trust rev-parse output only when that is the case, or something\n> like that.\n\nCute.\n\nI added specific handling for that.\n\nCiao,\nDscho\n"},{"id":"334860","messageId":"cover.1513294410.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":"cover.1512752468.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 0/2] Offer more information in `git version --build-options`'s output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-14T23:34:28Z","receivedAt":"2017-12-14T23:34:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"In Git for Windows, we ask users to paste the output of said command\ninto their bug reports, with the idea that this frequently helps\nidentify where the problems are coming from.\n\nThere are some obvious missing bits of information in said output,\nthough, and this patch series tries to fill the gaps at least a little.\n\nChanges since v1:\n\n- replaced 1/2 by Eric's proposed alternative patch\n\n- when no commit can be determined, it now says\n\n\tno commit associated with this build\n  instead of\n\n\tbuilt from commit: (unknown)\n\n- the code is now careful not to look further than Git's top-level\n  directory for a Git repository from which to determine the current\n  commit. As Junio pointed out, some developer may extract Git's source\n  code from a tarball into a worktree of a completely different project.\n\n\nEric Sunshine (1):\n  version --build-options: also report host CPU\n\nJohannes Schindelin (1):\n  version --build-options: report commit, too, if possible\n\n Makefile  | 13 ++++++++++++-\n help.c    |  6 ++++++\n version.c |  1 +\n version.h |  1 +\n 4 files changed, 20 insertions(+), 1 deletion(-)\n\n\nbase-commit: 95ec6b1b3393eb6e26da40c565520a8db9796e9f\nPublished-As: https://github.com/dscho/git/releases/tag/built-from-commit-v2\nFetch-It-Via: git fetch https://github.com/dscho/git built-from-commit-v2\n\nInterdiff vs v1:\n diff --git a/Makefile b/Makefile\n index 92a0ae3d8e3..2ce70d205d9 100644\n --- a/Makefile\n +++ b/Makefile\n @@ -425,6 +425,9 @@ all::\n  #\n  # to say \"export LESS=FRX (and LV=-c) if the environment variable\n  # LESS (and LV) is not set, respectively\".\n +#\n +# When cross-compiling, define HOST_CPU as the canonical name of the CPU on\n +# which the built Git will run (for instance \"x86_64\").\n  \n  GIT-VERSION-FILE: FORCE\n  \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n @@ -1095,6 +1098,12 @@ else\n  BROKEN_PATH_FIX = '/^\\# @@BROKEN_PATH_FIX@@$$/d'\n  endif\n  \n +ifeq (,$(HOST_CPU))\n +\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(firstword $(subst -, ,$(uname_M)))\\\"\"\n +else\n +\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(HOST_CPU)\\\"\"\n +endif\n +\n  ifneq (,$(INLINE))\n  \tBASIC_CFLAGS += -Dinline=$(INLINE)\n  endif\n @@ -1894,8 +1903,8 @@ version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT\n  version.sp version.s version.o: EXTRA_CPPFLAGS = \\\n  \t'-DGIT_VERSION=\"$(GIT_VERSION)\"' \\\n  \t'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \\\n -\t'-DGIT_BUILT_FROM_COMMIT=\"$(shell git rev-parse -q --verify HEAD || \\\n -\t\techo \"(unknown)\")\"'\n +\t'-DGIT_BUILT_FROM_COMMIT=\"$(shell GIT_CEILING_DIRECTORIES=\\\"$(CURDIR)/..\\\" \\\n +\t\tgit rev-parse -q --verify HEAD || :)\"'\n  \n  $(BUILT_INS): git$X\n  \t$(QUIET_BUILT_IN)$(RM) $@ && \\\n diff --git a/help.c b/help.c\n index 6ebea665780..60071a9beaa 100644\n --- a/help.c\n +++ b/help.c\n @@ -390,7 +390,6 @@ const char *help_unknown_cmd(const char *cmd)\n  \n  int cmd_version(int argc, const char **argv, const char *prefix)\n  {\n -\tstatic char build_platform[] = GIT_BUILD_PLATFORM;\n  \tint build_options = 0;\n  \tconst char * const usage[] = {\n  \t\tN_(\"git version [<options>]\"),\n @@ -413,10 +412,13 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n  \tprintf(\"git version %s\\n\", git_version_string);\n  \n  \tif (build_options) {\n -\t\tprintf(\"built from commit: %s\\n\",\n -\t\t       git_built_from_commit_string);\n +\t\tprintf(\"cpu: %s\\n\", GIT_HOST_CPU);\n +\t\tif (git_built_from_commit_string[0])\n +\t\t\tprintf(\"built from commit: %s\\n\",\n +\t\t\t       git_built_from_commit_string);\n +\t\telse\n +\t\t\tprintf(\"no commit associated with this build\\n\");\n  \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n -\t\tprintf(\"machine: %s\\n\", build_platform);\n  \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n  \t}\n  \treturn 0;\n diff --git a/help.h b/help.h\n index 42dd9852194..b21d7c94e8c 100644\n --- a/help.h\n +++ b/help.h\n @@ -33,16 +33,3 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru\n   */\n  extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);\n  #endif /* HELP_H */\n -\n -/*\n - * identify build platform\n - */\n -#ifndef GIT_BUILD_PLATFORM\n -\t#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__\n -\t\t#define GIT_BUILD_PLATFORM \"x86\"\n -\t#elif defined __x86_64__\n -\t\t#define GIT_BUILD_PLATFORM \"x86_64\"\n -\t#else\n -\t\t#define GIT_BUILD_PLATFORM \"unknown\"\n -\t#endif\n -#endif\n-- \n2.15.1.windows.2\n\n"},{"id":"334861","messageId":"a827bc297da7c7dcfa51c07b5fa29dd474fa287e.1513294410.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":"cover.1513294410.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 1/2] version --build-options: also report host CPU","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-14T23:34:34Z","receivedAt":"2017-12-14T23:34:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Eric Sunshine <sunshine@sunshineco.com>\n\nIt can be helpful for bug reports to include information about the\nenvironment in which the bug occurs. \"git version --build-options\" can\nhelp to supplement this information. In addition to the size of 'long'\nalready reported by --build-options, also report the host's CPU type.\nExample output:\n\n   $ git version --build-options\n   git version 2.9.3.windows.2.826.g06c0f2f\n   cpu: x86_64\n   sizeof-long: 4\n\nNew Makefile variable HOST_CPU supports cross-compiling.\n\nSuggested-by: Adric Norris <landstander668@gmail.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n Makefile | 9 +++++++++\n help.c   | 1 +\n 2 files changed, 10 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex fef9c8d2725..5587bccc932 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -425,6 +425,9 @@ all::\n #\n # to say \"export LESS=FRX (and LV=-c) if the environment variable\n # LESS (and LV) is not set, respectively\".\n+#\n+# When cross-compiling, define HOST_CPU as the canonical name of the CPU on\n+# which the built Git will run (for instance \"x86_64\").\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -1095,6 +1098,12 @@ else\n BROKEN_PATH_FIX = '/^\\# @@BROKEN_PATH_FIX@@$$/d'\n endif\n \n+ifeq (,$(HOST_CPU))\n+\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(firstword $(subst -, ,$(uname_M)))\\\"\"\n+else\n+\tBASIC_CFLAGS += -DGIT_HOST_CPU=\"\\\"$(HOST_CPU)\\\"\"\n+endif\n+\n ifneq (,$(INLINE))\n \tBASIC_CFLAGS += -Dinline=$(INLINE)\n endif\ndiff --git a/help.c b/help.c\nindex 88a3aeaeb9f..cbcb159f367 100644\n--- a/help.c\n+++ b/help.c\n@@ -412,6 +412,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n \tprintf(\"git version %s\\n\", git_version_string);\n \n \tif (build_options) {\n+\t\tprintf(\"cpu: %s\\n\", GIT_HOST_CPU);\n \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n \t}\n-- \n2.15.1.windows.2\n\n\n"},{"id":"334862","messageId":"9b379e2060ca06e9cac44cdc69df327022be9c80.1513294410.git.johannes.schindelin@gmx.de","threadId":"47412","inReplyTo":"cover.1513294410.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 2/2] version --build-options: report commit, too, if possible","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-12-14T23:34:38Z","receivedAt":"2017-12-14T23:34:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"In particular when local tags are used (or tags that are pushed to some\nfork) to build Git, it is very hard to figure out from which particular\nrevision a particular Git executable was built. It gets worse when those\ntags are deleted, or even updated.\n\nLet's just report an exact, unabbreviated commit name in our build\noptions.\n\nWe need to be careful, though, to report when the current commit cannot\nbe determined, e.g. when building from a tarball without any associated\nGit repository. This could be the case also when extracting Git's source\ncode into an unrelated Git worktree.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n Makefile  | 4 +++-\n help.c    | 5 +++++\n version.c | 1 +\n version.h | 1 +\n 4 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 5587bccc932..2ce70d205d9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1902,7 +1902,9 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \\\n version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT\n version.sp version.s version.o: EXTRA_CPPFLAGS = \\\n \t'-DGIT_VERSION=\"$(GIT_VERSION)\"' \\\n-\t'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'\n+\t'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \\\n+\t'-DGIT_BUILT_FROM_COMMIT=\"$(shell GIT_CEILING_DIRECTORIES=\\\"$(CURDIR)/..\\\" \\\n+\t\tgit rev-parse -q --verify HEAD || :)\"'\n \n $(BUILT_INS): git$X\n \t$(QUIET_BUILT_IN)$(RM) $@ && \\\ndiff --git a/help.c b/help.c\nindex cbcb159f367..60071a9beaa 100644\n--- a/help.c\n+++ b/help.c\n@@ -413,6 +413,11 @@ int cmd_version(int argc, const char **argv, const char *prefix)\n \n \tif (build_options) {\n \t\tprintf(\"cpu: %s\\n\", GIT_HOST_CPU);\n+\t\tif (git_built_from_commit_string[0])\n+\t\t\tprintf(\"built from commit: %s\\n\",\n+\t\t\t       git_built_from_commit_string);\n+\t\telse\n+\t\t\tprintf(\"no commit associated with this build\\n\");\n \t\tprintf(\"sizeof-long: %d\\n\", (int)sizeof(long));\n \t\t/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */\n \t}\ndiff --git a/version.c b/version.c\nindex 6106a8098c8..41b718c29e1 100644\n--- a/version.c\n+++ b/version.c\n@@ -3,6 +3,7 @@\n #include \"strbuf.h\"\n \n const char git_version_string[] = GIT_VERSION;\n+const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;\n \n const char *git_user_agent(void)\n {\ndiff --git a/version.h b/version.h\nindex 6911a4f1558..7c62e805771 100644\n--- a/version.h\n+++ b/version.h\n@@ -2,6 +2,7 @@\n #define VERSION_H\n \n extern const char git_version_string[];\n+extern const char git_built_from_commit_string[];\n \n const char *git_user_agent(void);\n const char *git_user_agent_sanitized(void);\n-- \n2.15.1.windows.2\n"},{"id":"334895","messageId":"xmqqind7rik1.fsf@gitster.mtv.corp.google.com","threadId":"47412","inReplyTo":"cover.1513294410.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH v2 0/2] Offer more information in `git version --build-options`'s output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-15T17:45:50Z","receivedAt":"2017-12-15T17:45:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> - when no commit can be determined, it now says\n>\n> \tno commit associated with this build\n>   instead of\n>\n> \tbuilt from commit: (unknown)\n\nI find this output somewhat klunky for machine parsing (and it is\ninconsistent with the style used for \"sizeof-long\", which hints that\nthese are \"<token> <colon> <value>\" lines where whitespaces are\navoided in a <token>), but hopefully this is primarily for human\nconsumption and scrypts that are trying to find a specific piece of\ninformation would know how to use 'grep', so the inconsistency does\nnot make much of a difference in practice anyway.\n\nQueued.  Thanks.\n"},{"id":"334896","messageId":"CAPig+cRymagTe20ZJS4Z0DyPy0_OuE7zEuP1wiEk0rWhDdk6nw@mail.gmail.com","threadId":"47412","inReplyTo":"xmqqind7rik1.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 0/2] Offer more information in `git version --build-options`'s output","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-15T18:03:05Z","receivedAt":"2017-12-15T18:03:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Dec 15, 2017 at 12:45 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n>>       no commit associated with this build\n>\n> I find this output somewhat klunky for machine parsing (and it is\n> inconsistent with the style used for \"sizeof-long\", which hints that\n> these are \"<token> <colon> <value>\" lines where whitespaces are\n> avoided in a <token>), but hopefully this is primarily for human\n> consumption and scrypts that are trying to find a specific piece of\n> information would know how to use 'grep', so the inconsistency does\n> not make much of a difference in practice anyway.\n\nSimply omitting that line from the output of --build-options would\nalso be an option if the commit can not be determined...\n"},{"id":"334897","messageId":"xmqqefnvrhbj.fsf@gitster.mtv.corp.google.com","threadId":"47412","inReplyTo":"CAPig+cRymagTe20ZJS4Z0DyPy0_OuE7zEuP1wiEk0rWhDdk6nw@mail.gmail.com","subject":"Re: [PATCH v2 0/2] Offer more information in `git version --build-options`'s output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-12-15T18:12:32Z","receivedAt":"2017-12-15T18:12:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Fri, Dec 15, 2017 at 12:45 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n>>>       no commit associated with this build\n>>\n>> I find this output somewhat klunky for machine parsing (and it is\n>> inconsistent with the style used for \"sizeof-long\", which hints that\n>> these are \"<token> <colon> <value>\" lines where whitespaces are\n>> avoided in a <token>), but hopefully this is primarily for human\n>> consumption and scrypts that are trying to find a specific piece of\n>> information would know how to use 'grep', so the inconsistency does\n>> not make much of a difference in practice anyway.\n>\n> Simply omitting that line from the output of --build-options would\n> also be an option if the commit can not be determined...\n\nWhat we see in Dscho's patch is better than that option, though.  At\nleast, explicitly checking for \"no commit associated\" would tell you\nif the version of Git is too old to have \"built from commit:\" line\nor it is new enough but was built from a tarball.\n"}]}