{"thread":{"id":"9491","subject":"msysgit, help: teach git help to open html from /doc/git/html/","startedAt":"2007-08-11T20:44:24Z","lastAt":"2007-08-12T10:49:53Z","messageCount":6,"participants":["Steffen Prohaska","Junio C Hamano","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"50501","messageId":"51772B53-642F-4D52-9CF3-906A21FC0D6F@zib.de","threadId":"9491","inReplyTo":null,"subject":"msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-11T20:44:24Z","receivedAt":"2007-08-11T20:44:24Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"I pushed the following patch to 4msysgit.git's mob branch\n\n[ I finally found the mob branch at\nssh://mob@repo.or.cz/srv/git/git/mingw/4msysgit.git\nwhich apparently was one git too much for my brain. ]\n\n\ncommit a9a42a347894edfbca33e48bed0fcd38ec334a35\n\n     help (msysgit): teach git help to open html from /doc/git/html/\n\n     Html pages will be opened using the default Windows application\n     configured for html. This code path is taken for msysgit (mingw).\n\n     It is assumed that html pages are installed at /doc/git/html.\n     This needs to be ensured by the msysgit superproject to make this\n     patch useful. html pages should be cloned from git.git's main\n     repo. This is the easiest way to get up-to-date documentation,\n     without requiring the complete tool chain to generate them\n     locally.\n\n     If html pages are not yet there, you can use the following\n     commands to get them:\n\n         mkdir -p /doc/git/html\n         cd /doc/git/html/\n         git init\n         git config remote.origin.url git://git.kernel.org/pub/scm/ \ngit/git.git\n         git config remote.origin.fetch refs/heads/html:refs/remotes/ \norigin/html\n         git fetch\n         git checkout --track -b html origin/html\n\n     and update the html documentation with\n\n         git pull\n\nThe superproject should be setup in /share/GitMe/setup-msysgit.sh to\nfetch the html pages as a submodule. But I don't understanding\nsubmodules good enough to do so.\n\nIf you then type 'git help <command>' Firefox or Explorer or whatever\nyou configured as your default html viewer will show you the git help.\nI think this is a good idea for Windows users.\n\n\nJunio,\nare you interested in such patches at this time. The patch doesn't\ninterfere with the existing code, but clutters it with ifdefs.\n\n\tSteffen\n"},{"id":"50506","messageId":"7vps1tlpbb.fsf@assigned-by-dhcp.cox.net","threadId":"9491","inReplyTo":"51772B53-642F-4D52-9CF3-906A21FC0D6F@zib.de","subject":"Re: msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-11T21:43:52Z","receivedAt":"2007-08-11T21:43:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> writes:\n\n> Junio,\n> are you interested in such patches at this time. The patch doesn't\n> interfere with the existing code, but clutters it with ifdefs.\n\nActually \"showing HTML pages upon 'git help' request\" makes\nsense even on Unixen.  I think a patch to help.c::cmd_help()\nthat allows the user to specify alternate action before going to\nthe codepath to call show_man_page(help_cmd) would make sense,\nlike the attached patch.\n\nHaving said that, a patch that makes the build procedure depend\non the presense of the html branch is unacceptable, as that\nbranch does not even exist in my private build repository.  If\nyou are building html pages from the source, it surely would\nmake sense.\n\n---\n cache.h       |    3 +++\n config.c      |    5 +++++\n environment.c |    1 +\n help.c        |    3 ++-\n 4 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 4507404..d7aeaaf 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -597,4 +597,7 @@ extern void *convert_sha1_file(const char *path, const unsigned char *sha1, unsi\n /* match-trees.c */\n void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int);\n \n+/* help.c - show manual page for the named command */\n+extern char *custom_help_cmd;\n+\n #endif /* CACHE_H */\ndiff --git a/config.c b/config.c\nindex dc3148d..8a9d0b7 100644\n--- a/config.c\n+++ b/config.c\n@@ -431,6 +431,11 @@ int git_default_config(const char *var, const char *value)\n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"core.helpcmd\")) {\n+\t\tcustom_help_cmd = xstrdup(value);\n+\t\treturn 0;\n+\t}\n+\n \t/* Add other config variables here and to Documentation/config.txt. */\n \treturn 0;\n }\ndiff --git a/environment.c b/environment.c\nindex b5a6c69..05c4ba5 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -34,6 +34,7 @@ char *pager_program;\n int pager_in_use;\n int pager_use_color = 1;\n char *editor_program;\n+char *custom_help_cmd;\n int auto_crlf = 0;\t/* 1: both ways, -1: only when adding git objects */\n \n /* This is set by setup_git_dir_gently() and/or git_default_config() */\ndiff --git a/help.c b/help.c\nindex 1cd33ec..49db50d 100644\n--- a/help.c\n+++ b/help.c\n@@ -168,6 +168,7 @@ static void list_common_cmds_help(void)\n static void show_man_page(const char *git_cmd)\n {\n \tconst char *page;\n+\tconst char *help = custom_help_cmd ? custom_help_cmd : \"man\";\n \n \tif (!prefixcmp(git_cmd, \"git\"))\n \t\tpage = git_cmd;\n@@ -180,7 +181,7 @@ static void show_man_page(const char *git_cmd)\n \t\tpage = p;\n \t}\n \n-\texeclp(\"man\", \"man\", page, NULL);\n+\texeclp(help, help, page, NULL);\n }\n \n void help_unknown_cmd(const char *cmd)\n"},{"id":"50510","messageId":"37CBFBA3-6A07-44D7-BFCF-5C969C123000@zib.de","threadId":"9491","inReplyTo":"7vps1tlpbb.fsf@assigned-by-dhcp.cox.net","subject":"Re: msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-11T22:05:21Z","receivedAt":"2007-08-11T22:05:21Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 11, 2007, at 11:43 PM, Junio C Hamano wrote:\n\n> Steffen Prohaska <prohaska@zib.de> writes:\n>\n>> Junio,\n>> are you interested in such patches at this time. The patch doesn't\n>> interfere with the existing code, but clutters it with ifdefs.\n>\n> Actually \"showing HTML pages upon 'git help' request\" makes\n> sense even on Unixen.  I think a patch to help.c::cmd_help()\n> that allows the user to specify alternate action before going to\n> the codepath to call show_man_page(help_cmd) would make sense,\n> like the attached patch.\n\nSo the custom command needs to have the knowledge how to find\nthe page (as 'man' has), based on the string 'git-<command>'.\n\nMakes sense to me to build only the generic mechanism into\nhelp.c and delegate the rest to core.helpcmd.\n\n\n> Having said that, a patch that makes the build procedure depend\n> on the presense of the html branch is unacceptable, as that\n> branch does not even exist in my private build repository.\n\nSure, the build procedure doesn't depend on it. The executable\nwouldn't do anything useful if no html is present.\n\n\n> If you are building html pages from the source, it surely would\n> make sense.\n\nI'd prefer to fetch pages from your repo, at least for msysgit.\nBuilding them requires tools that are, to my knowledge, not\npresent in msysgit.\n\n\tSteffen\n"},{"id":"50523","messageId":"fcaeb9bf0708111710m1eca7a82t71d471e40e84ef93@mail.gmail.com","threadId":"9491","inReplyTo":"51772B53-642F-4D52-9CF3-906A21FC0D6F@zib.de","subject":"Re: msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-08-12T00:10:21Z","receivedAt":"2007-08-12T00:10:21Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This reminds me a patch I made before:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/49217/focus=49575\n\nWith a little modification you can use ShellExecute to open html if\nthere is no suitable program to open it. The last commit on\nmingw.git's mob branch does that (not based on my mentioned patch\nthough).\n\nOn 8/11/07, Steffen Prohaska <prohaska@zib.de> wrote:\n> I pushed the following patch to 4msysgit.git's mob branch\n>\n> [ I finally found the mob branch at\n> ssh://mob@repo.or.cz/srv/git/git/mingw/4msysgit.git\n> which apparently was one git too much for my brain. ]\n>\n>\n> commit a9a42a347894edfbca33e48bed0fcd38ec334a35\n>\n>      help (msysgit): teach git help to open html from /doc/git/html/\n>\n>      Html pages will be opened using the default Windows application\n>      configured for html. This code path is taken for msysgit (mingw).\n>\n>      It is assumed that html pages are installed at /doc/git/html.\n>      This needs to be ensured by the msysgit superproject to make this\n>      patch useful. html pages should be cloned from git.git's main\n>      repo. This is the easiest way to get up-to-date documentation,\n>      without requiring the complete tool chain to generate them\n>      locally.\n>\n>      If html pages are not yet there, you can use the following\n>      commands to get them:\n>\n>          mkdir -p /doc/git/html\n>          cd /doc/git/html/\n>          git init\n>          git config remote.origin.url git://git.kernel.org/pub/scm/\n> git/git.git\n>          git config remote.origin.fetch refs/heads/html:refs/remotes/\n> origin/html\n>          git fetch\n>          git checkout --track -b html origin/html\n>\n>      and update the html documentation with\n>\n>          git pull\n>\n> The superproject should be setup in /share/GitMe/setup-msysgit.sh to\n> fetch the html pages as a submodule. But I don't understanding\n> submodules good enough to do so.\n>\n> If you then type 'git help <command>' Firefox or Explorer or whatever\n> you configured as your default html viewer will show you the git help.\n> I think this is a good idea for Windows users.\n>\n>\n> Junio,\n> are you interested in such patches at this time. The patch doesn't\n> interfere with the existing code, but clutters it with ifdefs.\n>\n>         Steffen\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\n\n-- \nDuy\n"},{"id":"50524","messageId":"fcaeb9bf0708111716y29d6a719r995304b96c1b3eb2@mail.gmail.com","threadId":"9491","inReplyTo":"fcaeb9bf0708111710m1eca7a82t71d471e40e84ef93@mail.gmail.com","subject":"Re: msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-08-12T00:16:20Z","receivedAt":"2007-08-12T00:16:20Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 8/11/07, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> This reminds me a patch I made before:\n>\n> http://thread.gmane.org/gmane.comp.version-control.git/49217/focus=49575\n\nAnd the second patch:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/49216\n\n> With a little modification you can use ShellExecute to open html if\n> there is no suitable program to open it. The last commit on\n> mingw.git's mob branch does that (not based on my mentioned patch\n> though).\n-- \nDuy\n"},{"id":"50544","messageId":"F4A816A8-4139-45BD-9A86-EFB1DFE251E7@zib.de","threadId":"9491","inReplyTo":"fcaeb9bf0708111716y29d6a719r995304b96c1b3eb2@mail.gmail.com","subject":"Re: msysgit, help: teach git help to open html from /doc/git/html/","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-12T10:49:53Z","receivedAt":"2007-08-12T10:49:53Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 12, 2007, at 2:16 AM, Nguyen Thai Ngoc Duy wrote:\n\n> On 8/11/07, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n>> This reminds me a patch I made before:\n>>\n>> http://thread.gmane.org/gmane.comp.version-control.git/49217/ \n>> focus=49575\n>\n> And the second patch:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/49216\n>\n>> With a little modification you can use ShellExecute to open html if\n>> there is no suitable program to open it. The last commit on\n>> mingw.git's mob branch does that (not based on my mentioned patch\n>> though).\n\nSo we have three approached now:\n\n1) Nguyen's approach using '--html'/core.help=html to explicitly\nchoose html as the format of choice. The core.htmlprogram is used\nand a printf style format string can be used to specify required\ncommand line parameters.\n\n2) Junio's light-weight core.helpcmd, which gets passed the string\nthat would normally be passed to 'man'. Helpcmd needs to figure\nout how to do the right thing. Most likely helpcmd would be a\nsmall shell script that does the mapping to a file or url for\ndisplaying the help. But it can also be a more complex thing,\nfor example load a Windows chm file and jump to a specific anchor,\nor whatsoever.\n\n3) Steffen's msysgit specific code path to display always locally\ninstalled html pages on Windows, and never display 'man' pages.\n\n\n From my perspective, (3) would be the fastest way to get a useful\ngit help in msysgit. It only needs to be applied and shipped. But\nit provides no benefit for git.git on other architectures.\n\n(2) is a very light-weight extension to core git, yet capable of\nproviding everything we need, or can think of in the future. It\nmakes sense to me to delegate the details how to find the help,\nbased on the git command, to an external helper.\n\nMaybe I work a bit more on Junio's approach later the day. I would\nlike to see a useful help system in msysgit before advertising it\nto a larger audience that has no git experience.\n\n\tSteffen\n"}]}