]> Lady’s Gitweb - Gitweb/commitdiff
Enable highlight executable path as a configuration option
authorChristopher Wilson <redacted>
Tue, 21 Sep 2010 07:25:19 +0000 (00:25 -0700)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:30 +0000 (00:51 -0400)
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 <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
Makefile
README
gitweb.perl

index 605d7578607a5f64513a76eb85b6fa5a78f75b5243a967ca832d349030b6b9fb..2f6b8f5bf900fb5fd6d535867099878861dd0e671539fe2a2905a633cdacab7f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -35,6 +35,7 @@ GITWEB_FAVICON = static/git-favicon.png
 GITWEB_JS = static/gitweb.js
 GITWEB_SITE_HEADER =
 GITWEB_SITE_FOOTER =
+HIGHLIGHT_BIN = highlight
 
 # include user config
 -include ../config.mak.autogen
@@ -129,7 +130,8 @@ GITWEB_REPLACE = \
        -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
        -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
        -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
-       -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g'
+       -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
+       -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
 
 GITWEB-BUILD-OPTIONS: FORCE
        @rm -f $@+
diff --git a/README b/README
index 2c1024e1ab4794c62e53ca5494dea59d6a58b8a033af85bdb81ee9bb93e0dd1b..6c5e776af52047b40fcfbc20c708cc550b18ead16352a4eafe306e7c96ae1ab4 100644 (file)
--- a/README
+++ b/README
@@ -113,7 +113,11 @@ You can specify the following configuration variables when building GIT:
    does not exist.  If the environment variable GITWEB_CONFIG_SYSTEM is set
    when gitweb.cgi is executed, then the file specified in the environment
    variable will be loaded instead of the file specified when gitweb.cgi was
-   created.  [Default: /etc/gitweb.conf]
+   created.  [Default: /etc/gitweb.conf]+ * HIGHLIGHT_BIN
+   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]
 
 Runtime gitweb configuration
 ----------------------------
@@ -235,7 +239,11 @@ not include variables usually directly set during build):
    If server load exceed this value then return "503 Service Unavailable" error.
    Server load is taken to be 0 if gitweb cannot determine its value.  Set it to
    undefined value to turn it off.  The default is 300.
-
+ * $highlight_bin
+   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]
 
 Projects list file format
 ~~~~~~~~~~~~~~~~~~~~~~~~~
index b6f6236635f8ec54e4668969c0733860eb5a72dd3fb1095585114639c20c51e6..e6bbf787cbe59937decd6cf8dcaddbd73316cd58980830a13b8c805c1c91fd97 100755 (executable)
@@ -166,6 +166,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 => {
@@ -3361,7 +3367,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;
 }
This page took 0.041463 seconds and 4 git commands to generate.