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

Re: [PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 2, 2010, 23:43 UTC
Message-ID
<m3mxzr9pcz.fsf@localhost.localdomain>
In-Reply-To
<1265147814-13284-3-git-send-email-warthog9@eaglescrag.net>
"John 'Warthog9' Hawley" <warthog9@eaglescrag.net> writes:
Show 36 quoted lines
> I'm unsure why this was placed in their originally, and it seems to
> ultimately stem from code from before gitweb was merged into git core,
> but there's an instance where git chops a string incorrectly based on
> this.
> 
> 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...
> 
> This reverts that specific problem.
> ---
>  gitweb/gitweb.perl |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 57771a0..4cc6d19 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1382,7 +1382,6 @@ sub chop_str {
>  		my $body = $1;
>  		my $tail = $2;
>  		if (length($tail) > 4) {
> -			$body =~ s/&[^;]*$//;
>  			$tail = "... ";
>  		}
>  		return "$body$tail";

I think it is a good change. chop_str is meant to be used _before_ HTML escaping (esc_html or equivalent) is to be applied; removed line looks like it was meant (badly) to always remove HTML entities fully... but those entities are only added later.

So now what is left is to come up with proper commit message, and add
Signed-off-by: John 'Warthog9' Hawley" <warthog9@kernel.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: John 'Warthog9' HawleyNext: J.H.
Message 4 of 9 in “gitweb misc fixes mkII”
  1. 0/2 gitweb misc fixes mkIIJohn 'Warthog9' Hawley, Feb 2, 2010
  2. 1/2 gitweb: Add an option to force version matchJohn 'Warthog9' Hawley, Feb 2, 2010
  3. 2/2 gitweb: Fix chop_str to allow for & characters in stringsJohn 'Warthog9' Hawley, Feb 2, 2010
  4. Jakub NarebskiFeb 2, 2010
  5. J.H.Feb 2, 2010
  6. gitweb: Simplify (and fix) chop_strJakub Narebski, Feb 3, 2010
  7. J.H.Feb 3, 2010
  8. Junio C HamanoFeb 2, 2010
  9. Jakub NarebskiFeb 2, 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.