[PATCH] git-help: Try to find html pages without the git- prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux