Skip to content

Commit d65279d

Browse files
committed
Merge branch 'mh/html-path'
* mh/html-path: add --html-path to get the location of installed HTML docs
2 parents 982962c + 89a56bf commit d65279d

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

Documentation/git.txt

Lines changed: 5 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[=GIT_EXEC_PATH]]
12+
'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
1313
[-p|--paginate|--no-pager]
1414
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
1515
[--help] COMMAND [ARGS]
@@ -178,6 +178,10 @@ help ...`.
178178
environment variable. If no path is given, 'git' will print
179179
the current setting and then exit.
180180

181+
--html-path::
182+
Print the path to wherever your git HTML documentation is installed
183+
and exit.
184+
181185
-p::
182186
--paginate::
183187
Pipe all output into 'less' (or if set, $PAGER).

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,7 @@ strip: $(PROGRAMS) git$X
11911191

11921192
git.o: git.c common-cmds.h GIT-CFLAGS
11931193
$(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
1194+
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
11941195
$(ALL_CFLAGS) -c $(filter %.c,$^)
11951196

11961197
git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)

contrib/completion/git-completion.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,7 @@ _git ()
18711871
--bare
18721872
--version
18731873
--exec-path
1874+
--html-path
18741875
--work-tree=
18751876
--help
18761877
"

git.c

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

77
const char git_usage_string[] =
8-
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
8+
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
99

1010
const char git_more_info_string[] =
1111
"See 'git help COMMAND' for more information on a specific command.";
@@ -75,6 +75,9 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
7575
puts(git_exec_path());
7676
exit(0);
7777
}
78+
} else if (!strcmp(cmd, "--html-path")) {
79+
puts(system_path(GIT_HTML_PATH));
80+
exit(0);
7881
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
7982
use_pager = 1;
8083
} else if (!strcmp(cmd, "--no-pager")) {

perl/Git.pm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ require Exporter;
5656
@EXPORT_OK = qw(command command_oneline command_noisy
5757
command_output_pipe command_input_pipe command_close_pipe
5858
command_bidi_pipe command_close_bidi_pipe
59-
version exec_path hash_object git_cmd_try
59+
version exec_path html_path hash_object git_cmd_try
6060
remote_refs
6161
temp_acquire temp_release temp_reset temp_path);
6262

@@ -492,6 +492,16 @@ C<git --exec-path>). Useful mostly only internally.
492492
sub exec_path { command_oneline('--exec-path') }
493493

494494

495+
=item html_path ()
496+
497+
Return path to the Git html documentation (the same as
498+
C<git --html-path>). Useful mostly only internally.
499+
500+
=cut
501+
502+
sub html_path { command_oneline('--html-path') }
503+
504+
495505
=item repo_path ()
496506
497507
Return path to the git repository. Must be called on a repository instance.

0 commit comments

Comments
 (0)