summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb22bc4)
raw | patch | inline | side by side (parent: cb22bc4)
author | Andreas Ericsson <exon@op5.se> | |
Tue, 15 Nov 2005 23:31:25 +0000 (00:31 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 Nov 2005 00:03:00 +0000 (16:03 -0800) |
It's by design a bit stupid (matching ^git rather than ^git-), so as
to work with 'gitk' and 'git' as well.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
to work with 'gitk' and 'git' as well.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git.txt | patch | blob | history | |
git.c | patch | blob | history |
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 15ae4f12d001787a9df0fcee6b2b98c48c44283c..338e5acb8b488f12b6eb4c26c047aef017df1bd6 100644 (file)
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
--help::
prints the synopsis and a list of available commands.
+ If a git command is named this option will bring up the
+ man-page for that command.
--exec-path::
path to wherever your core git programs are installed.
index d18980135f469338cc65051c2c6664d2ac5d3838..583923d960f4d7e13656f3e6b7b9d8197bfa6a20 100644 (file)
--- a/git.c
+++ b/git.c
setenv("PATH", path, 1);
}
+/* has anyone seen 'man' installed anywhere else than in /usr/bin? */
+#define PATH_TO_MAN "/usr/bin/man"
+static void show_man_page(char *git_cmd)
+{
+ char *page;
+
+ if (!strncmp(git_cmd, "git", 3))
+ page = git_cmd;
+ else {
+ int page_len = strlen(git_cmd) + 4;
+
+ page = malloc(page_len + 1);
+ strcpy(page, "git-");
+ strcpy(page + 4, git_cmd);
+ page[page_len] = 0;
+ }
+
+ execlp(PATH_TO_MAN, "man", page, NULL);
+}
+
int main(int argc, char **argv, char **envp)
{
char git_command[PATH_MAX + 1];
usage(NULL, NULL);
}
- if (i >= argc || show_help)
- usage(exec_path, NULL);
+ if (i >= argc || show_help) {
+ if (i >= argc)
+ usage(exec_path, NULL);
+
+ show_man_page(argv[i]);
+ }
/* allow relative paths, but run with exact */
if (chdir(exec_path)) {