From f2dd8c3799ddbd7df63a89a9043916f8545a70a3 Mon Sep 17 00:00:00 2001 From: Jon Seymour Date: Sun, 1 May 2011 18:16:25 +1000 Subject: [PATCH 1/2] git: add --info-path and --man-path options Similar to the way the --html-path option lets UI programs learn where git has its HTML documentation pages, expose the other two paths used to store the documentation pages of these two types. Signed-off-by: Jon Seymour Signed-off-by: Junio C Hamano --- Documentation/git.txt | 10 +++++++++- Makefile | 4 +++- git.c | 8 +++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index 9d5949229a..7e9b521cd9 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -9,7 +9,7 @@ git - the stupid content tracker SYNOPSIS -------- [verse] -'git' [--version] [--exec-path[=]] [--html-path] +'git' [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [-c =] @@ -290,6 +290,14 @@ help ...`. Print the path to wherever your git HTML documentation is installed and exit. +--man-path:: + Print the path to wherever your git man pages are installed + and exit. + +--info-path:: + Print the path to wherever your git Info files are installed + and exit. + -p:: --paginate:: Pipe all output into 'less' (or if set, $PAGER) if standard diff --git a/Makefile b/Makefile index cbc3fce2d5..322c59b761 100644 --- a/Makefile +++ b/Makefile @@ -1676,7 +1676,9 @@ strip: $(PROGRAMS) git$X git.o: common-cmds.h git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \ - '-DGIT_HTML_PATH="$(htmldir_SQ)"' + '-DGIT_HTML_PATH="$(htmldir_SQ)"' \ + '-DGIT_MAN_PATH="$(mandir_SQ)"' \ + '-DGIT_INFO_PATH="$(infodir_SQ)"' git$X: git.o $(BUILTIN_OBJS) $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \ diff --git a/git.c b/git.c index ef598c3e70..60a9403771 100644 --- a/git.c +++ b/git.c @@ -6,7 +6,7 @@ #include "run-command.h" const char git_usage_string[] = - "git [--version] [--exec-path[=]] [--html-path]\n" + "git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path]\n" " [-p|--paginate|--no-pager] [--no-replace-objects]\n" " [--bare] [--git-dir=] [--work-tree=]\n" " [-c name=value] [--help]\n" @@ -95,6 +95,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) } else if (!strcmp(cmd, "--html-path")) { puts(system_path(GIT_HTML_PATH)); exit(0); + } else if (!strcmp(cmd, "--man-path")) { + puts(system_path(GIT_MAN_PATH)); + exit(0); + } else if (!strcmp(cmd, "--info-path")) { + puts(system_path(GIT_INFO_PATH)); + exit(0); } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { use_pager = 1; } else if (!strcmp(cmd, "--no-pager")) { From 239b5ed9c9b7b7f219b05c8d71e29db7b970eb48 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 2 May 2011 01:07:45 -0500 Subject: [PATCH 2/2] Documentation: clarify meaning of --html-path, --man-path, and --info-path These options tell UI programs where git put its documentation, so "Help" actions can show the documentation for *this* version of git without regard to how MANPATH and INFOPATH are set up. Details: . Each variable tells where documentation is expected to be. They do not indicate whether documentation was actually installed. . The output of "git --html-path" is an absolute path and can be used in "file://$(git --html-path)/git-add.html" to name the HTML file documenting a particular command. . --man-path names a manual page hierarchy (e.g., /home/user/share/man). Its output can be passed to "man -M" or put at the beginning of $MANPATH. . --info-path names a directory with info files (e.g., /home/user/share/info). Its output is suitable as an argument to "info -d" or for inclusion in $INFOPATH. Helped-by: Junio C Hamano Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index 7e9b521cd9..5295315fe7 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -287,16 +287,16 @@ help ...`. the current setting and then exit. --html-path:: - Print the path to wherever your git HTML documentation is installed - and exit. + Print the path, without trailing slash, where git's HTML + documentation is installed and exit. --man-path:: - Print the path to wherever your git man pages are installed - and exit. + Print the manpath (see `man(1)`) for the man pages for + this version of git and exit. --info-path:: - Print the path to wherever your git Info files are installed - and exit. + Print the path where the Info files documenting this + version of git are installed and exit. -p:: --paginate::