{"thread":{"id":"13303","subject":"[PATCH] git-help: Try to find html pages without the git- prefix","startedAt":"2008-04-28T10:13:31Z","lastAt":"2008-04-29T05:18:47Z","messageCount":4,"participants":["Pieter de Bie","Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"75364","messageId":"1209377611-90005-1-git-send-email-pdebie@ai.rug.nl","threadId":"13303","inReplyTo":null,"subject":"[PATCH] git-help: Try to find html pages without the git- prefix","fromName":"Pieter de Bie","fromEmail":"pdebie@ai.rug.nl","sentAt":"2008-04-28T10:13:31Z","receivedAt":"2008-04-28T10:13:31Z","isPatch":true,"sender":{"key":"pdebie@ai.rug.nl","avatar":null},"body":"Some html documentation does not have the git- prefix, for example hooks.html.\nIf the git-command.html page does not exist, try to find the command.html\nfile. This allows commands like `git help -w hooks' to work\n---\n help.c |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/help.c b/help.c\nindex 10298fb..633bfc9 100644\n--- a/help.c\n+++ b/help.c\n@@ -488,11 +488,15 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)\n \n static void show_html_page(const char *git_cmd)\n {\n+\tstruct stat st;\n \tconst char *page = cmd_to_page(git_cmd);\n \tstruct strbuf page_path; /* it leaks but we exec bellow */\n \n \tget_html_page_path(&page_path, page);\n \n+\tif (stat(page_path.buf, &st) || !S_ISREG(st.st_mode))\n+\t\tget_html_page_path(&page_path, git_cmd);\n+\n \texecl_git_cmd(\"web--browse\", \"-c\", \"help.browser\", page_path.buf, NULL);\n }\n \n-- \n1.5.5.1.174.g32fa0.dirty\n"},{"id":"75484","messageId":"200804290513.40948.chriscool@tuxfamily.org","threadId":"13303","inReplyTo":"1209377611-90005-1-git-send-email-pdebie@ai.rug.nl","subject":"Re: [PATCH] git-help: Try to find html pages without the git- prefix","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-04-29T03:13:40Z","receivedAt":"2008-04-29T03:13:40Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le lundi 28 avril 2008, Pieter de Bie a écrit :\n> Some html documentation does not have the git- prefix, for example\n> hooks.html. If the git-command.html page does not exist, try to find the\n> command.html file. This allows commands like `git help -w hooks' to work\n\nYes, this works fine for html documentation.\n\nBut 'git help -w githooks' could work fine too, if the source filename \nwas \"githooks.txt\" instead of \"hooks.txt\". Because the \"cmd_to_page\" \nfunction returns its input as is, if it starts with \"git\".\n\nAnd with more filenames like \"githooks.txt\" we could also have \nmore \"githooks\" like regular man pages without poluting too much the man \npage namespace.\n\nWe already have the following files following that scheme:\n\ngitk.txt\ngitattributes.txt\ngitignore.txt\ngitcli.txt\ngitmodules.txt\ngit.txt\n\nAnd for example the following commands are already working:\n\n$ git help -w gitmodules\n$ git help -m gitmodules\n$ man gitmodules\n\n(\"git help -i gitmodules\" should work too, but info format help seems \nbroken.)\n\nOf course typing \"git help hooks\" is shorter and simpler than \"git help \ngithooks\", so it could perhaps still be a good idea to try \"gitXXX\" as a \nfallback if we find nothing for \"git-XXX\".\n\nThanks,\nChristian.\n"},{"id":"75487","messageId":"7vy76x8e0s.fsf@gitster.siamese.dyndns.org","threadId":"13303","inReplyTo":"200804290513.40948.chriscool@tuxfamily.org","subject":"Re: [PATCH] git-help: Try to find html pages without the git- prefix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-29T04:45:55Z","receivedAt":"2008-04-29T04:45:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> We already have the following files following that scheme:\n>\n> gitk.txt\n> gitattributes.txt\n> gitignore.txt\n> gitcli.txt\n> gitmodules.txt\n> git.txt\n>\n> And for example the following commands are already working:\n>\n> $ git help -w gitmodules\n> $ git help -m gitmodules\n> $ man gitmodules\n\nThat is not surprise as gitattributes(5), gitignore(5) and gitmodules(5)\nwork by design.  They are valid manual pages in section 5 (file formats).\n\nI am not sure about hooks let alone gitcli --- they are not something you\nwould traditionally place in section 5.\n\nIt would be nice if \"git help <any path you see in Documentation/>\" worked\nas expected, although I personally tend to go to the *.txt files ;-)\n"},{"id":"75489","messageId":"200804290718.47961.chriscool@tuxfamily.org","threadId":"13303","inReplyTo":"7vy76x8e0s.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-help: Try to find html pages without the git- prefix","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-04-29T05:18:47Z","receivedAt":"2008-04-29T05:18:47Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le mardi 29 avril 2008, Junio C Hamano a écrit :\n> Christian Couder <chriscool@tuxfamily.org> writes:\n> > We already have the following files following that scheme:\n> >\n> > gitk.txt\n> > gitattributes.txt\n> > gitignore.txt\n> > gitcli.txt\n> > gitmodules.txt\n> > git.txt\n> >\n> > And for example the following commands are already working:\n> >\n> > $ git help -w gitmodules\n> > $ git help -m gitmodules\n> > $ man gitmodules\n>\n> That is not surprise as gitattributes(5), gitignore(5) and gitmodules(5)\n> work by design.  They are valid manual pages in section 5 (file formats).\n>\n> I am not sure about hooks let alone gitcli --- they are not something you\n> would traditionally place in section 5.\n\nAren't there other man sections where we could put them ?\n\n> It would be nice if \"git help <any path you see in Documentation/>\"\n> worked as expected, \n\nI agree and that means that we should find an appropriate man section for \neverything in \"Documentation/\". Otherwise how could \"git help -m <any path \nyou see in Documentation/>\" work ?\n\nThanks,\nChristian.\n\n> although I personally tend to go to the *.txt files \n> ;-)\n"}]}