summaryrefslogtreecommitdiff
path: root/gitweb/gitweb.perl
diff options
context:
space:
mode:
authorChristopher Wilson <cwilson@cdwilson.us>2010-09-21 07:25:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-27 17:47:04 (GMT)
commit7ce896b3000a7bd2ea24f02ad3051f43ad351e1f (patch)
treea9836b042514967c5a5ca14addc75f010ae4c911 /gitweb/gitweb.perl
parent9027fa9eb7df606b6658dd48a40bb993ce222ddd (diff)
downloadgit-7ce896b3000a7bd2ea24f02ad3051f43ad351e1f.zip
git-7ce896b3000a7bd2ea24f02ad3051f43ad351e1f.tar.gz
git-7ce896b3000a7bd2ea24f02ad3051f43ad351e1f.tar.bz2
Enable highlight executable path as a configuration option
Allow build-time/run-time configuration of the highlight executable (must be the one from http://www.andre-simon.de due to assumptions about parameters and output). Defaults to previous behavior which assumes that highlight is available on the server PATH. However, if this is not the case, the path to the highlight executable can be configured at build time as a configuration variable HIGHLIGHT_BIN = /path/to/highlight or at runtime by configuring GITWEB_CONFIG $highlight_bin = /path/to/highlight Signed-off-by: Christopher Wilson <cwilson@cdwilson.us> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-xgitweb/gitweb.perl9
1 files changed, 8 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a85e2f6..e5910ce 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -165,6 +165,12 @@ our @diff_opts = ('-M'); # taken from git_commit
# the gitweb domain.
our $prevent_xss = 0;
+# Path to the highlight executable to use (must be the one from
+# http://www.andre-simon.de due to assumptions about parameters and output).
+# Useful if highlight is not installed on your webserver's PATH.
+# [Default: highlight]
+our $highlight_bin = "++HIGHLIGHT_BIN++";
+
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
# name => {
@@ -3360,7 +3366,8 @@ sub run_highlighter {
close $fd
or die_error(404, "Reading blob failed");
open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
- "highlight --xhtml --fragment --syntax $syntax |"
+ quote_command($highlight_bin).
+ " --xhtml --fragment --syntax $syntax |"
or die_error(500, "Couldn't open file or run syntax highlighter");
return $fd;
}