git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Enable highlight executable path as a configuration option

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 20, 2010, 09:10 UTC
Message-ID
<201009201110.38271.jnareb@gmail.com>
In-Reply-To
<4C96938C.5050505@cdwilson.us>
On Mon, 20 Sep 2010, Christopher Wilson wrote:
Show 12 quoted lines
> Allow build-time/run-time configuration of the highlight executable. 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>

Good idea... but I am not sure about shell quoting and the problem with spaces in pathnames. See comments below.

Show 5 quoted lines
> ---
>  gitweb/Makefile    |    4 +++-
>  gitweb/README      |    7 ++++++-
>  gitweb/gitweb.perl |    6 +++++-
>  3 files changed, 14 insertions(+), 3 deletions(-)
Show 11 quoted lines
> diff --git a/gitweb/README b/gitweb/README
> index d481198..69f9860 100644
> --- a/gitweb/README
> +++ b/gitweb/README
> @@ -114,6 +114,9 @@ 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. Useful if highlight is not
> +   installed on your webserver's PATH. [Default: highlight]
  
I think it needs to be said that this 'highlight' executable must be 
the one from http://www.andre-simon.de (assumptions about parameters and
output).
  
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index a85e2f6..e808485 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
[...]
Show 6 quoted lines
> @@ -3360,7 +3364,7 @@ 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 |"
> +	          "$highlight_bin --xhtml --fragment --syntax $syntax |"
I think you need 
  +	          quote_command($highlight_bin)." --xhtml --fragment --syntax $syntax |"
here
Show 7 quoted lines
>  		or die_error(500, "Couldn't open file or run syntax highlighter");
>  	return $fd;
>  }
> -- 
> 1.7.2.3
> 
> 
-- 
Jakub Narebski
Poland
Next: Christopher Wilson
Message 1 of 3 in “Re: [PATCH] Enable highlight executable path as a configuration option”
  1. Jakub NarebskiSep 20, 2010
  2. Christopher WilsonSep 21, 2010
  3. Jakub NarebskiSep 21, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.