Skip to content

Commit f2dd8c3

Browse files
jonseymourgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec014ea commit f2dd8c3

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Documentation/git.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git - the stupid content tracker
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git' [--version] [--exec-path[=<path>]] [--html-path]
12+
'git' [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
1313
[-p|--paginate|--no-pager] [--no-replace-objects]
1414
[--bare] [--git-dir=<path>] [--work-tree=<path>]
1515
[-c <name>=<value>]
@@ -290,6 +290,14 @@ help ...`.
290290
Print the path to wherever your git HTML documentation is installed
291291
and exit.
292292

293+
--man-path::
294+
Print the path to wherever your git man pages are installed
295+
and exit.
296+
297+
--info-path::
298+
Print the path to wherever your git Info files are installed
299+
and exit.
300+
293301
-p::
294302
--paginate::
295303
Pipe all output into 'less' (or if set, $PAGER) if standard

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,9 @@ strip: $(PROGRAMS) git$X
16761676

16771677
git.o: common-cmds.h
16781678
git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
1679-
'-DGIT_HTML_PATH="$(htmldir_SQ)"'
1679+
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1680+
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
1681+
'-DGIT_INFO_PATH="$(infodir_SQ)"'
16801682

16811683
git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
16821684
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \

git.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "run-command.h"
77

88
const char git_usage_string[] =
9-
"git [--version] [--exec-path[=<path>]] [--html-path]\n"
9+
"git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
1010
" [-p|--paginate|--no-pager] [--no-replace-objects]\n"
1111
" [--bare] [--git-dir=<path>] [--work-tree=<path>]\n"
1212
" [-c name=value] [--help]\n"
@@ -95,6 +95,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
9595
} else if (!strcmp(cmd, "--html-path")) {
9696
puts(system_path(GIT_HTML_PATH));
9797
exit(0);
98+
} else if (!strcmp(cmd, "--man-path")) {
99+
puts(system_path(GIT_MAN_PATH));
100+
exit(0);
101+
} else if (!strcmp(cmd, "--info-path")) {
102+
puts(system_path(GIT_INFO_PATH));
103+
exit(0);
98104
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
99105
use_pager = 1;
100106
} else if (!strcmp(cmd, "--no-pager")) {

0 commit comments

Comments
 (0)