git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-help: Try to find html pages without the git- prefix
@ 2008-04-28 10:13 Pieter de Bie
  2008-04-29  3:13 ` Christian Couder
  0 siblings, 1 reply; 4+ messages in thread
From: Pieter de Bie @ 2008-04-28 10:13 UTC (permalink / raw)
  To: git; +Cc: Pieter de Bie

Some html documentation does not have the git- prefix, for example hooks.html.
If the git-command.html page does not exist, try to find the command.html
file. This allows commands like `git help -w hooks' to work
---
 help.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/help.c b/help.c
index 10298fb..633bfc9 100644
--- a/help.c
+++ b/help.c
@@ -488,11 +488,15 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
 
 static void show_html_page(const char *git_cmd)
 {
+	struct stat st;
 	const char *page = cmd_to_page(git_cmd);
 	struct strbuf page_path; /* it leaks but we exec bellow */
 
 	get_html_page_path(&page_path, page);
 
+	if (stat(page_path.buf, &st) || !S_ISREG(st.st_mode))
+		get_html_page_path(&page_path, git_cmd);
+
 	execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL);
 }
 
-- 
1.5.5.1.174.g32fa0.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-29  5:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-28 10:13 [PATCH] git-help: Try to find html pages without the git- prefix Pieter de Bie
2008-04-29  3:13 ` Christian Couder
2008-04-29  4:45   ` Junio C Hamano
2008-04-29  5:18     ` Christian Couder

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 NNTP newsgroup(s).