Skip to content

Commit 314ae0f

Browse files
committed
Merge branch 'cw/gitweb-hilite-config'
* cw/gitweb-hilite-config: Enable highlight executable path as a configuration option
2 parents ee79b21 + 7ce896b commit 314ae0f

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

gitweb/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ GITWEB_FAVICON = static/git-favicon.png
3535
GITWEB_JS = static/gitweb.js
3636
GITWEB_SITE_HEADER =
3737
GITWEB_SITE_FOOTER =
38+
HIGHLIGHT_BIN = highlight
3839

3940
# include user config
4041
-include ../config.mak.autogen
@@ -129,7 +130,8 @@ GITWEB_REPLACE = \
129130
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
130131
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
131132
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
132-
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g'
133+
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
134+
-e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
133135

134136
GITWEB-BUILD-OPTIONS: FORCE
135137
@rm -f $@+

gitweb/README

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ You can specify the following configuration variables when building GIT:
114114
when gitweb.cgi is executed, then the file specified in the environment
115115
variable will be loaded instead of the file specified when gitweb.cgi was
116116
created. [Default: /etc/gitweb.conf]
117+
* HIGHLIGHT_BIN
118+
Path to the highlight executable to use (must be the one from
119+
http://www.andre-simon.de due to assumptions about parameters and output).
120+
Useful if highlight is not installed on your webserver's PATH.
121+
[Default: highlight]
117122

118123

119124
Runtime gitweb configuration
@@ -236,7 +241,11 @@ not include variables usually directly set during build):
236241
If server load exceed this value then return "503 Service Unavailable" error.
237242
Server load is taken to be 0 if gitweb cannot determine its value. Set it to
238243
undefined value to turn it off. The default is 300.
239-
244+
* $highlight_bin
245+
Path to the highlight executable to use (must be the one from
246+
http://www.andre-simon.de due to assumptions about parameters and output).
247+
Useful if highlight is not installed on your webserver's PATH.
248+
[Default: highlight]
240249

241250
Projects list file format
242251
~~~~~~~~~~~~~~~~~~~~~~~~~

gitweb/gitweb.perl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ sub evaluate_uri {
165165
# the gitweb domain.
166166
our $prevent_xss = 0;
167167

168+
# Path to the highlight executable to use (must be the one from
169+
# http://www.andre-simon.de due to assumptions about parameters and output).
170+
# Useful if highlight is not installed on your webserver's PATH.
171+
# [Default: highlight]
172+
our $highlight_bin = "++HIGHLIGHT_BIN++";
173+
168174
# information about snapshot formats that gitweb is capable of serving
169175
our %known_snapshot_formats = (
170176
# name => {
@@ -3360,7 +3366,8 @@ sub run_highlighter {
33603366
close $fd
33613367
or die_error(404, "Reading blob failed");
33623368
open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
3363-
"highlight --xhtml --fragment --syntax $syntax |"
3369+
quote_command($highlight_bin).
3370+
" --xhtml --fragment --syntax $syntax |"
33643371
or die_error(500, "Couldn't open file or run syntax highlighter");
33653372
return $fd;
33663373
}

0 commit comments

Comments
 (0)