From: "Jakub Narębski" <jnareb@gmail.com>
To: Ian Kelling <ian@iankelling.org>, git@vger.kernel.org
Subject: Re: [PATCH v4 2/2] gitweb: use highlight's shebang detection
Date: Sun, 25 Sep 2016 20:04:30 +0200 [thread overview]
Message-ID: <c35fc760-ae64-5df3-5985-7eecd06d937f@gmail.com> (raw)
In-Reply-To: <20160924223258.9449-2-ian@iankelling.org>
W dniu 25.09.2016 o 00:32, Ian Kelling pisze:
> The "highlight" binary can, in some cases, determine the language type
> by the means of file contents, for example the shebang in the first line
> for some scripting languages. Make use of this autodetection for files
> which syntax is not known by gitweb. In that case, pass the blob
> contents to "highlight --force"; the parameter is needed to make it
> always generate HTML output (which includes HTML-escaping).
>
> Although we now run highlight on files which do not end up highlighted,
> performance is virtually unaffected because when we call highlight, it
> is used for escaping HTML. In the case that highlight is used, gitweb
> calls sanitize() instead of esc_html(), and the latter is significantly
> slower (it does more, being roughly a superset of sanitize()). Simple
> benchmark comparing performance of 'blob' view of files without syntax
> highlighting in gitweb before and after this change indicates ±1%
> difference in request time for all file types. Benchmark was performed
> on local instance on Debian, using Apache/2.4.23 web server and CGI.
>
> Document the feature and improve syntax highlight documentation, add
> test to ensure gitweb doesn't crash when language detection is used.
>
> Signed-off-by: Ian Kelling <ian@iankelling.org>
For what it is worth it:
Acked-by: Jakub Narębski <jnareb@gmail.com>
(but unfortunately *not* tested by).
> ---
>
> Notes:
> The only change from v3 is the commit message as suggested by Jakub
> Narębski
>
> Documentation/gitweb.conf.txt | 21 ++++++++++++++-------
> gitweb/gitweb.perl | 10 +++++-----
> t/t9500-gitweb-standalone-no-errors.sh | 8 ++++++++
> 3 files changed, 27 insertions(+), 12 deletions(-)
next prev parent reply other threads:[~2016-09-25 18:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 19:00 [PATCH] gitweb: use highlight's shebang detection Ian Kelling
2016-09-20 20:22 ` Jakub Narębski
2016-09-21 16:38 ` Junio C Hamano
2016-09-21 17:51 ` Jakub Narębski
2016-09-21 22:15 ` Ian Kelling
2016-09-21 22:18 ` Ian Kelling
2016-09-21 22:24 ` Ian Kelling
2016-09-22 22:50 ` [PATCH v2] " Jakub Narębski
2016-09-23 9:08 ` Ian Kelling
2016-09-23 9:08 ` [PATCH v3 1/2] gitweb: remove unused function parameter Ian Kelling
2016-09-23 9:08 ` [PATCH v3 2/2] gitweb: use highlight's shebang detection Ian Kelling
2016-09-23 22:15 ` Jakub Narębski
2016-09-24 16:21 ` Jakub Narębski
2016-09-24 17:52 ` Junio C Hamano
2016-09-24 22:35 ` Ian Kelling
2016-09-24 22:34 ` Ian Kelling
2016-09-24 22:32 ` [PATCH v4 1/2] gitweb: remove unused guess_file_syntax() parameter Ian Kelling
2016-09-24 22:32 ` [PATCH v4 2/2] gitweb: use highlight's shebang detection Ian Kelling
2016-09-25 18:04 ` Jakub Narębski [this message]
2016-09-28 7:37 ` Ian Kelling
2016-09-25 17:57 ` [PATCH v4 1/2] gitweb: remove unused guess_file_syntax() parameter Jakub Narębski
2016-09-23 19:44 ` [PATCH v3 1/2] gitweb: remove unused function parameter Jakub Narębski
2016-09-23 19:57 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c35fc760-ae64-5df3-5985-7eecd06d937f@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=ian@iankelling.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).