public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "J.H." <warthog9@eaglescrag•net>
To: Jakub Narebski <jnareb@gmail•com>
Cc: git@vger•kernel.org, "John 'Warthog9' Hawley" <warthog9@kernel•org>
Subject: Re: [PATCH] gitweb: Simplify (and fix) chop_str
Date: Wed, 03 Feb 2010 10:25:08 -0800	[thread overview]
Message-ID: <4B69BF84.8010400@eaglescrag.net> (raw)
In-Reply-To: <201002031228.31324.jnareb@gmail.com>

This looks good to me.

- John 'Warthog9' Hawley

On 02/03/2010 03:28 AM, Jakub Narebski wrote:
> From: John 'Warthog9' Hawley <warthog9@kernel•org>
> 
> The chop_str subroutine is meant to be used on strings (such as commit
> description / title) *before* HTML escaping, which means before
> applying esc_html or equivalent.
> 
> Therefore get rid of the failed attempt to always remove full HTML
> entities (like e.g. &amp; or &nbsp;).  It is not necessary (HTML
> entities gets added later), and it can cause chop_str to chop a string
> incorrectly.
> 
> Specifically:
> 
>      API & protocol: support option to force written data immediately to disk
> 
> from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54
> 
> The short version of the title gets chopped to
> 
>      API ...
> 
> where it should be
> 
>      API & protocol: support option to force written data...
> 
> Noticed-by: John 'Warthog9' Hawley <warthog9@kernel•org>
> Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel•org>
> Signed-off-by: Jakub Narebski <jnareb@gmail•com>
> ---
> I have retained J.H. authorship of this patch.  I have rewritten
> commit message, added signoffs, and removed all instances of failed
> attempt of removing HTML entities whole, even though only one of them
> is used.
> 
>  gitweb/gitweb.perl |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index d0c3ff2..1f6978a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1330,7 +1330,6 @@ sub chop_str {
>  		$str =~ m/^(.*?)($begre)$/;
>  		my ($lead, $body) = ($1, $2);
>  		if (length($lead) > 4) {
> -			$body =~ s/^[^;]*;// if ($lead =~ m/&[^;]*$/);
>  			$lead = " ...";
>  		}
>  		return "$lead$body";
> @@ -1341,8 +1340,6 @@ sub chop_str {
>  		$str =~ m/^(.*?)($begre)$/;
>  		my ($mid, $right) = ($1, $2);
>  		if (length($mid) > 5) {
> -			$left  =~ s/&[^;]*$//;
> -			$right =~ s/^[^;]*;// if ($mid =~ m/&[^;]*$/);
>  			$mid = " ... ";
>  		}
>  		return "$left$mid$right";
> @@ -1352,7 +1349,6 @@ sub chop_str {
>  		my $body = $1;
>  		my $tail = $2;
>  		if (length($tail) > 4) {
> -			$body =~ s/&[^;]*$//;
>  			$tail = "... ";
>  		}
>  		return "$body$tail";

  reply	other threads:[~2010-02-03 18:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 21:56 [PATCH 0/2] gitweb misc fixes mkII John 'Warthog9' Hawley
2010-02-02 21:56 ` [PATCH 1/2] gitweb: Add an option to force version match John 'Warthog9' Hawley
2010-02-02 21:56   ` [PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings John 'Warthog9' Hawley
2010-02-02 23:43     ` Jakub Narebski
2010-02-02 23:54       ` J.H.
2010-02-03 11:28         ` [PATCH] gitweb: Simplify (and fix) chop_str Jakub Narebski
2010-02-03 18:25           ` J.H. [this message]
2010-02-02 22:59   ` [PATCH 1/2] gitweb: Add an option to force version match Junio C Hamano
2010-02-02 23:56     ` Jakub Narebski

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B69BF84.8010400@eaglescrag.net \
    --to=warthog9@eaglescrag$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=jnareb@gmail$(echo .)com \
    --cc=warthog9@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox