author | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Dec 2007 09:22:42 +0000 (01:22 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Dec 2007 09:22:42 +0000 (01:22 -0800) |
This is to primarily pull in MANPATH tweak and help.txt formatting fix
from the master branch.
from the master branch.
1 | 2 | |||
---|---|---|---|---|
Documentation/Makefile | patch | | diff1 | | diff2 | | blob | history |
Documentation/git-help.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/git.txt | patch | | diff1 | | diff2 | | blob | history |
Makefile | patch | | diff1 | | diff2 | | blob | history |
help.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/Makefile
Simple merge
diff --cc Documentation/git-help.txt
Simple merge
diff --cc Documentation/git.txt
Simple merge
diff --cc Makefile
index 932b0d4346dc7480e1ce56ed33614cf9bb50a546,4cdb84ba6242595a5e0e4765a16497aad53a56f3..429bc1ddb55f502b5c7ed51515aa7600599b2f15
+++ b/Makefile
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
+ mandir_SQ = $(subst ','\'',$(mandir))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
template_dir_SQ = $(subst ','\'',$(template_dir))
+htmldir_SQ = $(subst ','\'',$(htmldir))
prefix_SQ = $(subst ','\'',$(prefix))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
diff --cc help.c
index ec0d0155ac79051c3fcfbbbc72db1ea32404e069,f935887d34f2d766120a2628ee13e074b76a6c17..56477f4506a94905c58dad09543bfbb68db61d91
+++ b/help.c
}
}
+static const char *cmd_to_page(const char *git_cmd)
+{
+ if (!git_cmd)
+ return "git";
+ else if (!prefixcmp(git_cmd, "git"))
+ return git_cmd;
+ else {
+ int page_len = strlen(git_cmd) + 4;
+ char *p = xmalloc(page_len + 1);
+ strcpy(p, "git-");
+ strcpy(p + 4, git_cmd);
+ p[page_len] = 0;
+ return p;
+ }
+}
+
+ static void setup_man_path(void)
+ {
+ struct strbuf new_path;
+ const char *old_path = getenv("MANPATH");
+
+ 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
+ * there is old_path, we need ':' as delimiter. */
+ strbuf_addstr(&new_path, GIT_MAN_PATH);
+ strbuf_addch(&new_path, ':');
+ if (old_path)
+ strbuf_addstr(&new_path, old_path);
+
+ setenv("MANPATH", new_path.buf, 1);
+
+ strbuf_release(&new_path);
+ }
+
static void show_man_page(const char *git_cmd)
{
- const char *page;
-
- if (!prefixcmp(git_cmd, "git"))
- page = git_cmd;
- else {
- int page_len = strlen(git_cmd) + 4;
- char *p = xmalloc(page_len + 1);
- strcpy(p, "git-");
- strcpy(p + 4, git_cmd);
- p[page_len] = 0;
- page = p;
- }
-
+ const char *page = cmd_to_page(git_cmd);
+ setup_man_path();
execlp("man", "man", page, NULL);
}