Re: msysgit, help: teach git help to open html from /doc/git/html/

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: msysgit, help: teach git help to open html from /doc/git/html/

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:28

Steffen Prohaska [off-list ref] writes:
Junio,
are you interested in such patches at this time. The patch doesn't
interfere with the existing code, but clutters it with ifdefs.
Actually "showing HTML pages upon 'git help' request" makes
sense even on Unixen.  I think a patch to help.c::cmd_help()
that allows the user to specify alternate action before going to
the codepath to call show_man_page(help_cmd) would make sense,
like the attached patch.

Having said that, a patch that makes the build procedure depend
on the presense of the html branch is unacceptable, as that
branch does not even exist in my private build repository.  If
you are building html pages from the source, it surely would
make sense.

---
 cache.h       |    3 +++
 config.c      |    5 +++++
 environment.c |    1 +
 help.c        |    3 ++-
 4 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/cache.h b/cache.h
index 4507404..d7aeaaf 100644
--- a/cache.h
+++ b/cache.h
@@ -597,4 +597,7 @@ extern void *convert_sha1_file(const char *path, const unsigned char *sha1, unsi
 /* match-trees.c */
 void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int);
 
+/* help.c - show manual page for the named command */
+extern char *custom_help_cmd;
+
 #endif /* CACHE_H */
diff --git a/config.c b/config.c
index dc3148d..8a9d0b7 100644
--- a/config.c
+++ b/config.c
@@ -431,6 +431,11 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.helpcmd")) {
+		custom_help_cmd = xstrdup(value);
+		return 0;
+	}
+
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
 }
diff --git a/environment.c b/environment.c
index b5a6c69..05c4ba5 100644
--- a/environment.c
+++ b/environment.c
@@ -34,6 +34,7 @@ char *pager_program;
 int pager_in_use;
 int pager_use_color = 1;
 char *editor_program;
+char *custom_help_cmd;
 int auto_crlf = 0;	/* 1: both ways, -1: only when adding git objects */
 
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
diff --git a/help.c b/help.c
index 1cd33ec..49db50d 100644
--- a/help.c
+++ b/help.c
@@ -168,6 +168,7 @@ static void list_common_cmds_help(void)
 static void show_man_page(const char *git_cmd)
 {
 	const char *page;
+	const char *help = custom_help_cmd ? custom_help_cmd : "man";
 
 	if (!prefixcmp(git_cmd, "git"))
 		page = git_cmd;
@@ -180,7 +181,7 @@ static void show_man_page(const char *git_cmd)
 		page = p;
 	}
 
-	execlp("man", "man", page, NULL);
+	execlp(help, help, page, NULL);
 }
 
 void help_unknown_cmd(const char *cmd)

Re: msysgit, help: teach git help to open html from /doc/git/html/

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:43:28

On Aug 11, 2007, at 11:43 PM, Junio C Hamano wrote:
Steffen Prohaska [off-list ref] writes:
quoted
Junio,
are you interested in such patches at this time. The patch doesn't
interfere with the existing code, but clutters it with ifdefs.
Actually "showing HTML pages upon 'git help' request" makes
sense even on Unixen.  I think a patch to help.c::cmd_help()
that allows the user to specify alternate action before going to
the codepath to call show_man_page(help_cmd) would make sense,
like the attached patch.
So the custom command needs to have the knowledge how to find
the page (as 'man' has), based on the string 'git-<command>'.

Makes sense to me to build only the generic mechanism into
help.c and delegate the rest to core.helpcmd.

Having said that, a patch that makes the build procedure depend
on the presense of the html branch is unacceptable, as that
branch does not even exist in my private build repository.
Sure, the build procedure doesn't depend on it. The executable
wouldn't do anything useful if no html is present.

If you are building html pages from the source, it surely would
make sense.
I'd prefer to fetch pages from your repo, at least for msysgit.
Building them requires tools that are, to my knowledge, not
present in msysgit.

	Steffen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help