From: Junio C Hamano <gitster@pobox.com>
To: Steffen Prohaska <prohaska@zib.de>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Marius Storm-Olsen <marius@trolltech.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: msysgit, help: teach git help to open html from /doc/git/html/
Date: Sat, 11 Aug 2007 14:43:52 -0700 [thread overview]
Message-ID: <7vps1tlpbb.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <51772B53-642F-4D52-9CF3-906A21FC0D6F@zib.de> (Steffen Prohaska's message of "Sat, 11 Aug 2007 22:44:24 +0200")
Steffen Prohaska <prohaska@zib.de> 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)
next prev parent reply other threads:[~2007-08-11 21:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-11 20:44 msysgit, help: teach git help to open html from /doc/git/html/ Steffen Prohaska
2007-08-11 21:43 ` Junio C Hamano [this message]
2007-08-11 22:05 ` Steffen Prohaska
2007-08-12 0:10 ` Nguyen Thai Ngoc Duy
2007-08-12 0:16 ` Nguyen Thai Ngoc Duy
2007-08-12 10:49 ` Steffen Prohaska
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vps1tlpbb.fsf@assigned-by-dhcp.cox.net \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=marius@trolltech.com \
--cc=prohaska@zib.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox