{"thread":{"id":"30727","subject":"[PATCH] Add the possibility to specify a default help format","startedAt":"2012-06-06T12:56:37Z","lastAt":"2012-06-06T21:21:27Z","messageCount":8,"participants":["Vincent van Ravesteijn","Jeff King","vfr@lyx.org","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"192980","messageId":"1338987397-7376-1-git-send-email-vfr@lyx.org","threadId":"30727","inReplyTo":null,"subject":"[PATCH] Add the possibility to specify a default help format","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-06-06T12:56:37Z","receivedAt":"2012-06-06T12:56:37Z","isPatch":true,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"At the moment, the default help format (i.e. the format that is chosen if\n'git help xxx' is called without a help format parameter) is defined by\nthe switch to be 'man'. However, on different platforms the preferred\nformat might differ. For example, on Windows there is no man viewer, so we\nwould prefer html.\n\nThis patch adds the possibility to choose a default help format on\ncompilation by defining DEFAULT_HELP_FORMAT. If it is not specified the\ndefault is still 'man'.\n\nSigned-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n---\n builtin/help.c |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 43d3c84..536d4fd 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -12,6 +12,10 @@\n #include \"column.h\"\n #include \"help.h\"\n \n+#ifndef DEFAULT_HELP_FORMAT\n+#define DEFAULT_HELP_FORMAT \"man\"\n+#endif\n+\n static struct man_viewer_list {\n \tstruct man_viewer_list *next;\n \tchar name[FLEX_ARRAY];\n@@ -445,7 +449,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \tsetup_git_directory_gently(&nongit);\n \tgit_config(git_help_config, NULL);\n \n-\tif (parsed_help_format != HELP_FORMAT_NONE)\n+\tif (parsed_help_format == HELP_FORMAT_NONE)\n+\t\thelp_format = parse_help_format(DEFAULT_HELP_FORMAT);\n+\telse\n \t\thelp_format = parsed_help_format;\n \n \talias = alias_lookup(argv[0]);\n-- \n1.7.9.msysgit.0\n"},{"id":"192993","messageId":"20120606135353.GD2597@sigill.intra.peff.net","threadId":"30727","inReplyTo":"1338987397-7376-1-git-send-email-vfr@lyx.org","subject":"Re: [PATCH] Add the possibility to specify a default help format","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-06-06T13:53:53Z","receivedAt":"2012-06-06T13:53:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 06, 2012 at 12:56:37PM +0000, Vincent van Ravesteijn wrote:\n\n> At the moment, the default help format (i.e. the format that is chosen if\n> 'git help xxx' is called without a help format parameter) is defined by\n> the switch to be 'man'. However, on different platforms the preferred\n> format might differ. For example, on Windows there is no man viewer, so we\n> would prefer html.\n> \n> This patch adds the possibility to choose a default help format on\n> compilation by defining DEFAULT_HELP_FORMAT. If it is not specified the\n> default is still 'man'.\n\nMakes sense to me.\n\n> ---\n>  builtin/help.c |    8 +++++++-\n>  1 files changed, 7 insertions(+), 1 deletions(-)\n\nShould there be some minor infrastructure in the Makefile so you can do:\n\n  make DEFAULT_HELP_FORMAT=man\n\nrather than:\n\n  make CFLAGS='-DDEFAULT_HELP_FORMAT=\\\"man\\\"'\n\n(and the Makefile would be a good place to advertise this build knob,\ntoo)?\n\n-Peff\n"},{"id":"193006","messageId":"1339008702-704-1-git-send-email-vfr@lyx.org","threadId":"30727","inReplyTo":"20120606135353.GD2597@sigill.intra.peff.net","subject":"[PATCH] Add the DEFAULT_HELP_FORMAT option to Makefile","fromName":"","fromEmail":"vfr@lyx.org","sentAt":"2012-06-06T18:51:42Z","receivedAt":"2012-06-06T18:51:42Z","isPatch":true,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"From: Vincent van Ravesteijn <vfr@lyx.org>\n\nThis patch advertises the DEFAULT_HELP_FORMAT compile option in Makefile. It will also allow to call 'make DEFAULT_HELP_FORMAT=info' to specify a different default.\n\nProposed-by: Jeff King <peff@peff.net>\nSigned-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n---\n Makefile |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ffbd7a4..b21afed 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,10 @@ all::\n # the diff algorithm.  It gives a nice speedup if your processor has\n # fast unaligned word loads.  Does NOT work on big-endian systems!\n # Enabled by default on x86_64.\n+#\n+# Define DEFAULT_HELP_FORMAT to \"man\", \"info\", \"web\" or \"html\"\n+# (defaults \"man\") if you want to have a different default when\n+# \"git help\" is called without a parameter specifying the format.\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -1238,6 +1242,7 @@ ifeq ($(uname_S),Windows)\n \tNATIVE_CRLF = YesPlease\n \tNO_INET_PTON = YesPlease\n \tNO_INET_NTOP = YesPlease\n+\tDEFAULT_HELP_FORMAT = html\n \n \tCC = compat/vcbuild/scripts/clink.pl\n \tAR = compat/vcbuild/scripts/lib.pl\n@@ -1917,6 +1922,10 @@ SHELL_PATH_CQ_SQ = $(subst ','\\'',$(SHELL_PATH_CQ))\n BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'\n endif\n \n+ifdef DEFAULT_HELP_FORMAT\n+BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='\"$(DEFAULT_HELP_FORMAT)\"'\n+endif\n+\n ALL_CFLAGS += $(BASIC_CFLAGS)\n ALL_LDFLAGS += $(BASIC_LDFLAGS)\n \n-- \n1.7.9.msysgit.0\n"},{"id":"193007","messageId":"7vzk8gl0p0.fsf@alter.siamese.dyndns.org","threadId":"30727","inReplyTo":"1339008702-704-1-git-send-email-vfr@lyx.org","subject":"Re: [PATCH] Add the DEFAULT_HELP_FORMAT option to Makefile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T19:06:35Z","receivedAt":"2012-06-06T19:06:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"vfr@lyx.org writes:\n\n> From: Vincent van Ravesteijn <vfr@lyx.org>\n>\n> This patch advertises the DEFAULT_HELP_FORMAT compile option in Makefile. It will also allow to call 'make DEFAULT_HELP_FORMAT=info' to specify a different default.\n>\n> Proposed-by: Jeff King <peff@peff.net>\n> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n> ---\n>  Makefile |    9 +++++++++\n>  1 files changed, 9 insertions(+), 0 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index ffbd7a4..b21afed 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -296,6 +296,10 @@ all::\n>  # the diff algorithm.  It gives a nice speedup if your processor has\n>  # fast unaligned word loads.  Does NOT work on big-endian systems!\n>  # Enabled by default on x86_64.\n> +#\n> +# Define DEFAULT_HELP_FORMAT to \"man\", \"info\", \"web\" or \"html\"\n> +# (defaults \"man\") if you want to have a different default when\n> +# \"git help\" is called without a parameter specifying the format.\n\nWe probably should just say 'html' without the idiotic 'web'\nsynonym.\n\n> @@ -1238,6 +1242,7 @@ ifeq ($(uname_S),Windows)\n>  \tNATIVE_CRLF = YesPlease\n>  \tNO_INET_PTON = YesPlease\n>  \tNO_INET_NTOP = YesPlease\n> +\tDEFAULT_HELP_FORMAT = html\n>  \n>  \tCC = compat/vcbuild/scripts/clink.pl\n>  \tAR = compat/vcbuild/scripts/lib.pl\n> @@ -1917,6 +1922,10 @@ SHELL_PATH_CQ_SQ = $(subst ','\\'',$(SHELL_PATH_CQ))\n>  BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'\n>  endif\n>  \n> +ifdef DEFAULT_HELP_FORMAT\n> +BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='\"$(DEFAULT_HELP_FORMAT)\"'\n> +endif\n> +\n>  ALL_CFLAGS += $(BASIC_CFLAGS)\n>  ALL_LDFLAGS += $(BASIC_LDFLAGS)\n\nThe choice of the variable name, decision to tweak BASIC_CFLAGS and\nthe placement of the tweak all look good to me.\n\nYou would also need actual code to react to -DDEFAULT_HELP_FORMAT in\nthe same patch.\n\nI think the choices of PAGER and EDITOR share the same problem, but\nshouldn't this choice recorded in GIT-BUILD-OPTIONS in some way?\n\nThanks.\n"},{"id":"193010","messageId":"4FCFBC9C.6010501@lyx.org","threadId":"30727","inReplyTo":"7vzk8gl0p0.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add the DEFAULT_HELP_FORMAT option to Makefile","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-06-06T20:25:00Z","receivedAt":"2012-06-06T20:25:00Z","isPatch":true,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"Op 6-6-2012 21:06, Junio C Hamano schreef:\n> I think the choices of PAGER and EDITOR share the same problem, but\n> shouldn't this choice recorded in GIT-BUILD-OPTIONS in some way?\n\nI don't know. The only place I know where GIT-BUILD-OPTIONS  is used is \nin the test suite. The test suite runs fine with the patches.\n\nVincent\n"},{"id":"193012","messageId":"1339014496-6736-1-git-send-email-vfr@lyx.org","threadId":"30727","inReplyTo":"1338987397-7376-1-git-send-email-vfr@lyx.org","subject":"[PATCHv2] Add the possibility to specify a default help format","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-06-06T20:28:16Z","receivedAt":"2012-06-06T20:28:16Z","isPatch":false,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"At the moment, the default help format (i.e. the format that is chosen if\n'git help xxx' is called without a help format parameter) is defined by\nthe switch to be 'man'. However, on different platforms the preferred\nformat might differ. For example, on Windows there is no man viewer, so we\nwould prefer html.\n\nThis patch adds the possibility to choose a default help format on\ncompilation by defining DEFAULT_HELP_FORMAT. If it is not specified the\ndefault is still 'man'.\n\nExample:\n  make DEFAULT_HELP_FORMAT=info\n\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n---\n Makefile       |    9 +++++++++\n builtin/help.c |    8 +++++++-\n 2 files changed, 16 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 4592f1f..9df6213 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -296,6 +296,10 @@ all::\n # the diff algorithm.  It gives a nice speedup if your processor has\n # fast unaligned word loads.  Does NOT work on big-endian systems!\n # Enabled by default on x86_64.\n+#\n+# Define DEFAULT_HELP_FORMAT to \"man\", \"info\" or \"html\" \n+# (defaults to \"man\") if you want to have a different default when\n+# \"git help\" is called without a parameter specifying the format.\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -1236,6 +1240,7 @@ ifeq ($(uname_S),Windows)\n \tBLK_SHA1 = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n+\tDEFAULT_HELP_FORMAT = html\n \n \tCC = compat/vcbuild/scripts/clink.pl\n \tAR = compat/vcbuild/scripts/lib.pl\n@@ -1915,6 +1920,10 @@ SHELL_PATH_CQ_SQ = $(subst ','\\'',$(SHELL_PATH_CQ))\n BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'\n endif\n \n+ifdef DEFAULT_HELP_FORMAT\n+BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='\"$(DEFAULT_HELP_FORMAT)\"'\n+endif\n+\n ALL_CFLAGS += $(BASIC_CFLAGS)\n ALL_LDFLAGS += $(BASIC_LDFLAGS)\n \ndiff --git a/builtin/help.c b/builtin/help.c\nindex 43d3c84..536d4fd 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -12,6 +12,10 @@\n #include \"column.h\"\n #include \"help.h\"\n \n+#ifndef DEFAULT_HELP_FORMAT\n+#define DEFAULT_HELP_FORMAT \"man\"\n+#endif\n+\n static struct man_viewer_list {\n \tstruct man_viewer_list *next;\n \tchar name[FLEX_ARRAY];\n@@ -445,7 +449,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \tsetup_git_directory_gently(&nongit);\n \tgit_config(git_help_config, NULL);\n \n-\tif (parsed_help_format != HELP_FORMAT_NONE)\n+\tif (parsed_help_format == HELP_FORMAT_NONE)\n+\t\thelp_format = parse_help_format(DEFAULT_HELP_FORMAT);\n+\telse\n \t\thelp_format = parsed_help_format;\n \n \talias = alias_lookup(argv[0]);\n-- \n1.7.9.msysgit.0\n"},{"id":"193015","messageId":"7vk3zkkv48.fsf@alter.siamese.dyndns.org","threadId":"30727","inReplyTo":"4FCFBC9C.6010501@lyx.org","subject":"Re: [PATCH] Add the DEFAULT_HELP_FORMAT option to Makefile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T21:07:03Z","receivedAt":"2012-06-06T21:07:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vincent van Ravesteijn <vfr@lyx.org> writes:\n\n> Op 6-6-2012 21:06, Junio C Hamano schreef:\n>> I think the choices of PAGER and EDITOR share the same problem, but\n>> shouldn't this choice recorded in GIT-BUILD-OPTIONS in some way?\n>\n> I don't know. The only place I know where GIT-BUILD-OPTIONS  is used\n> is in the test suite. The test suite runs fine with the patches.\n\nActually what I had in mind was GIT-CFLAGS which makes sure that we\nrebuild things when compilation options change, but ALL_CFLAGS is\ncovered already so there is no problem.\n\nThanks for a sanity check.\n"},{"id":"193017","messageId":"7vbokwkug8.fsf@alter.siamese.dyndns.org","threadId":"30727","inReplyTo":"1339014496-6736-1-git-send-email-vfr@lyx.org","subject":"Re: [PATCHv2] Add the possibility to specify a default help format","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T21:21:27Z","receivedAt":"2012-06-06T21:21:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vincent van Ravesteijn <vfr@lyx.org> writes:\n\n> Helped-by: Jeff King <peff@peff.net>\n> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>\n\nIf there were an existing test that assumes \"git help\" will default\nto \"man\" and verify output from the command, this patch alone will\nbreak it, but I didn't check.\n\nThanks; will queue (with some rephrasing of the log message).\n"}]}