Skip to content

Commit

Permalink
git: add --info-path and --man-path options
Browse files Browse the repository at this point in the history
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 <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jon Seymour authored and Junio C Hamano committed May 2, 2011
1 parent ec014ea commit f2dd8c3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git - the stupid content tracker
SYNOPSIS
--------
[verse]
'git' [--version] [--exec-path[=<path>]] [--html-path]
'git' [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree=<path>]
[-c <name>=<value>]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 7 additions & 1 deletion git.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "run-command.h"

const char git_usage_string[] =
"git [--version] [--exec-path[=<path>]] [--html-path]\n"
"git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
" [-p|--paginate|--no-pager] [--no-replace-objects]\n"
" [--bare] [--git-dir=<path>] [--work-tree=<path>]\n"
" [-c name=value] [--help]\n"
Expand Down Expand Up @@ -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")) {
Expand Down

0 comments on commit f2dd8c3

Please sign in to comment.