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

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

 



Steffen Prohaska <prohaska@xxxxxx> 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)

-
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