From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, David Kastrup <dak@gnu.org>
Subject: Re: [PATCH 0/3] git-help -i (info): finishing touches
Date: Tue, 11 Dec 2007 06:22:51 +0100 [thread overview]
Message-ID: <200712110622.51583.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7v8x42n9s4.fsf@gitster.siamese.dyndns.org>
Le lundi 10 décembre 2007, Junio C Hamano a écrit :
> Junio C Hamano <gitster@pobox.com> writes:
> > This series attempts to add finishing touches to "git help -i" (info)
> > support.
It looks like the patch series you talk about was not sent to the list.
In the last patch there is:
diff --git a/help.c b/help.c
index 9d7ad6f..c96b167 100644
--- a/help.c
+++ b/help.c
@@ -286,6 +286,7 @@ static void show_man_page(const char *git_cmd)
static void show_info_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
+ setenv("INFOPATH", GIT_INFO_PATH, 1);
execlp("info", "info", "gitman", page, NULL);
}
But I wonder if something like this would be better:
diff --git a/help.c b/help.c
index c96b167..933d850 100644
--- a/help.c
+++ b/help.c
@@ -255,23 +255,23 @@ static const char *cmd_to_page(const char *git_cmd)
}
}
-static void setup_man_path(void)
+static void prepend_to_env_path(const char *name, const char *value)
{
struct strbuf new_path;
- const char *old_path = getenv("MANPATH");
+ const char *old_path = getenv(name);
strbuf_init(&new_path, 0);
/* We should always put ':' after our path. If there is no
- * old_path, the ':' at the end will let 'man' to try
- * system-wide paths after ours to find the manual page. If
+ * old_path, the ':' at the end will let some commands
+ * like 'man' to try system-wide paths after ours. If
* there is old_path, we need ':' as delimiter. */
- strbuf_addstr(&new_path, GIT_MAN_PATH);
+ strbuf_addstr(&new_path, value);
strbuf_addch(&new_path, ':');
if (old_path)
strbuf_addstr(&new_path, old_path);
- setenv("MANPATH", new_path.buf, 1);
+ setenv(name, new_path.buf, 1);
strbuf_release(&new_path);
}
@@ -279,14 +279,14 @@ static void setup_man_path(void)
static void show_man_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
- setup_man_path();
+ prepend_to_env_path("MANPATH", GIT_MAN_PATH);
execlp("man", "man", page, NULL);
}
static void show_info_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
- setenv("INFOPATH", GIT_INFO_PATH, 1);
+ prepend_to_env_path("INFOPATH", GIT_INFO_PATH);
execlp("info", "info", "gitman", page, NULL);
}
Tell me if you want a proper path.
Christian.
next prev parent reply other threads:[~2007-12-11 5:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1197279969-10613-1-git-send-email-gitster@pobox.com>
2007-12-10 10:06 ` [PATCH 0/3] git-help -i (info): finishing touches Junio C Hamano
2007-12-11 5:22 ` Christian Couder [this message]
2007-12-11 5:27 ` Junio C Hamano
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=200712110622.51583.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=dak@gnu.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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;
as well as URLs for NNTP newsgroup(s).