Code

Merge branch 'cw/gitweb-hilite-config'
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 Oct 2010 19:10:35 +0000 (12:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Oct 2010 19:10:58 +0000 (12:10 -0700)
* cw/gitweb-hilite-config:
  Enable highlight executable path as a configuration option

gitweb/Makefile
gitweb/README
gitweb/gitweb.perl

index 2fb7c2d77bbd5f2041341822859dce51ae504d83..e32ee76309606c82abcac483f8801968916047f2 100644 (file)
@@ -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 $@+
index d4811987965e5a5036b7ed71e32d93578579073a..bf3664f2b7b7b4b5177d172c6b99a84940244469 100644 (file)
@@ -114,6 +114,11 @@ You can specify the following configuration variables when building GIT:
    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]
+ * 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
@@ -236,7 +241,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 a85e2f63197649bff4842ea2970448205618c104..e5910ce8f93cbfb92fdb2ed63c65140d9b8b39b3 100755 (executable)
@@ -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;
 }