git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Apr 28, 2008, 10:13 UTC
Message-ID
<1209377611-90005-1-git-send-email-pdebie@ai.rug.nl>
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
Next: Christian Couder
Message 1 of 4 in “git-help: Try to find html pages without the git- prefix”
  1. git-help: Try to find html pages without the git- prefixPieter de Bie, Apr 28, 2008
  2. Christian CouderApr 29, 2008
  3. Junio C HamanoApr 29, 2008
  4. Christian CouderApr 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.