<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/gitweb, branch v1.7.9.3</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.9.3</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.9.3'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2012-03-05T06:17:47Z</updated>
<entry>
<title>Merge branch 'jn/maint-gitweb-invalid-regexp' into maint</title>
<updated>2012-03-05T06:17:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-03-05T06:17:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=3ecd0c8b4d9e245e255aa4c061d6a474eb571298'/>
<id>urn:sha1:3ecd0c8b4d9e245e255aa4c061d6a474eb571298</id>
<content type='text'>
* jn/maint-gitweb-invalid-regexp:
  gitweb: Handle invalid regexp in regexp search
</content>
</entry>
<entry>
<title>gitweb: Handle invalid regexp in regexp search</title>
<updated>2012-02-28T19:45:31Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-02-28T18:41:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=36612e4daf8b5b5eaf16315aa13c66925f878cd6'/>
<id>urn:sha1:36612e4daf8b5b5eaf16315aa13c66925f878cd6</id>
<content type='text'>
When using regexp search ('sr' parameter / $search_use_regexp variable
is true), check first that regexp is valid.

Without this patch we would get an error from Perl during search (if
searching is performed by gitweb), or highlighting matches substring
(if applicable), if user provided invalid regexp... which means broken
HTML, with error page (including HTTP headers) generated after gitweb
already produced some output.

Add test that illustrates such error: for example for regexp "*\.git"
we would get the following error:

  Quantifier follows nothing in regex; marked by &lt;-- HERE in m/* &lt;-- HERE \.git/
  at /var/www/cgi-bin/gitweb.cgi line 3084.

Reported-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Signed-off-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jn/gitweb-unborn-head' into maint</title>
<updated>2012-02-27T23:33:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-02-27T23:33:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e22c522730b0fc1dd2a1f12b6e508c5fb2e0fe6c'/>
<id>urn:sha1:e22c522730b0fc1dd2a1f12b6e508c5fb2e0fe6c</id>
<content type='text'>
* jn/gitweb-unborn-head:
  gitweb: Fix "heads" view when there is no current branch
</content>
</entry>
<entry>
<title>gitweb: Fix 'grep' search for multiple matches in file</title>
<updated>2012-02-20T06:21:35Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-02-15T16:37:06Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=fc8fcd27e67ad06689a823dd83a929624e359cc1'/>
<id>urn:sha1:fc8fcd27e67ad06689a823dd83a929624e359cc1</id>
<content type='text'>
Commit ff7f218 (gitweb: Fix file links in "grep" search, 2012-01-05),
added $file_href variable, to reduce duplication and have the fix
applied in single place.

Unfortunately it made variable defined inside the loop, not taking into
account the fact that $file_href was set only if file changed.
Therefore for files with multiple matches $file_href was undefined for
second and subsequent matches.

Fix this bug by moving $file_href declaration outside loop.

Adds tests for almost all forms of sarch in gitweb, which were missing
from testuite.  Note that it only tests if there are no warnings, and
it doesn't check that gitweb finds what it should find.

Signed-off-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gitweb: Fix "heads" view when there is no current branch</title>
<updated>2012-02-17T16:25:30Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-02-15T15:36:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=fd49e56af68fbdc19a4dc72ca1cf811a239df595'/>
<id>urn:sha1:fd49e56af68fbdc19a4dc72ca1cf811a239df595</id>
<content type='text'>
In a repository whose HEAD points to an unborn branch with no commits,
"heads" view and "summary" view (which shows what is shown in "heads"
view) compared the object names of commits at the tip of branches with the
output from "git rev-parse HEAD", which caused comparison of a string with
undef and resulted in a warning in the server log.

This can happen if non-bare repository (with default 'master' branch)
is updated not via committing but by other means like push to it, or
Gerrit.  It can happen also just after running "git checkout --orphan
&lt;new branch&gt;" but before creating any new commit on this branch.

Rewrite the comparison so that it also works when $head points at nothing;
in such a case, no branch can be "the current branch", add a test for it.
While at it, rename local variable $head to $head_at, as it points to
current commit rather than current branch name (HEAD contents).

The code still incorrectly shows all branches that point at the same
commit as what HEAD points as "the current branch", even when HEAD is
detached. Fixing this bug is outside the scope of this patch.

Reported-by: Rajesh Boyapati
Signed-off-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gitweb: Allow UTF-8 encoded CGI query parameters and path_info</title>
<updated>2012-02-03T21:03:08Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-02-03T12:44:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=84d9e2d50ca9fbcf34e31cb74797fc182187c7b5'/>
<id>urn:sha1:84d9e2d50ca9fbcf34e31cb74797fc182187c7b5</id>
<content type='text'>
Gitweb forgot to turn query parameters into UTF-8. This results in a bug
that one cannot search for a string with characters outside US-ASCII.  For
example searching for "Michał Kiedrowicz" (containing letter 'ł' - LATIN
SMALL LETTER L WITH STROKE, with Unicode codepoint U+0142, represented
with 0xc5 0x82 bytes in UTF-8 and percent-encoded as %C5%82) result in the
following incorrect data in search field

	MichaÅ\202 Kiedrowicz

This is caused by CGI by default treating '0xc5 0x82' bytes as two
characters in Perl legacy encoding latin-1 (iso-8859-1), because 's'
query parameter is not processed explicitly as UTF-8 encoded string.

The solution used here follows "Using Unicode in a Perl CGI script"
article on http://www.lemoda.net/cgi/perl-unicode/index.html:

	use CGI;
	use Encode 'decode_utf8;
	my $value = params('input');
	$value = decode_utf8($value);

Decoding UTF-8 is done when filling %input_params hash and $path_info
variable; the former requires to move from explicit $cgi-&gt;param(&lt;label&gt;)
to $input_params{&lt;name&gt;} in a few places, which is a good idea anyway.

Also add -override=&gt;1 parameter to $cgi-&gt;textfield() invocation in search
form.  Otherwise CGI would use values from query string if it is present,
filling value from $cgi-&gt;param... without decode_utf8().  As we are using
value of appropriate parameter anyway, -override=&gt;1 doesn't change the
situation but makes gitweb fill search field correctly.

We could simply use the '-utf8' pragma (via "use CGI '-utf8';") to solve
this, but according to CGI.pm documentation, it may cause problems with
POST requests containing binary files, and it requires CGI 3.31 (I think),
released with perl v5.8.9.

Reported-by: Michał Kiedrowicz &lt;michal.kiedrowicz@gmail.com&gt;
Signed-off-by: Jakub Narębski &lt;jnareb@gmail.com&gt;
Tested-by: Michał Kiedrowicz &lt;michal.kiedrowicz@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jn/maint-gitweb-grep-fix'</title>
<updated>2012-01-17T00:45:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-01-17T00:45:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b63103e908af54e5e2eaa3faad350e4738ef0047'/>
<id>urn:sha1:b63103e908af54e5e2eaa3faad350e4738ef0047</id>
<content type='text'>
* jn/maint-gitweb-grep-fix:
  gitweb: Harden "grep" search against filenames with ':'
  gitweb: Fix file links in "grep" search
</content>
</entry>
<entry>
<title>Merge branch 'mm/maint-gitweb-project-maxdepth'</title>
<updated>2012-01-09T23:58:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-01-09T23:58:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=242ff87975199687d46bb8cca5207779a3872b6b'/>
<id>urn:sha1:242ff87975199687d46bb8cca5207779a3872b6b</id>
<content type='text'>
* mm/maint-gitweb-project-maxdepth:
  gitweb: accept trailing "/" in $project_list
</content>
</entry>
<entry>
<title>gitweb: Harden "grep" search against filenames with ':'</title>
<updated>2012-01-05T21:29:51Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-01-05T20:32:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8e09fd1a1e5ea8eaec960d47be51bde85df8870e'/>
<id>urn:sha1:8e09fd1a1e5ea8eaec960d47be51bde85df8870e</id>
<content type='text'>
Run "git grep" in "grep" search with '-z' option, to be able to parse
response also for files with filename containing ':' character.  The
':' character is otherwise (without '-z') used to separate filename
from line number and from matched line.

Note that this does not protect files with filename containing
embedded newline.  This would be hard but doable for text files, and
harder or even currently impossible with binary files: git does not
quote filename in

  "Binary file &lt;foo&gt; matches"

message, but new `--break` and/or `--header` options to git-grep could
help here.

Signed-off-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gitweb: Fix file links in "grep" search</title>
<updated>2012-01-05T21:29:50Z</updated>
<author>
<name>Jakub Narebski</name>
<email>jnareb@gmail.com</email>
</author>
<published>2012-01-05T20:26:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=ff7f2185d6e04b7bea66f39ee51d79919ab1279c'/>
<id>urn:sha1:ff7f2185d6e04b7bea66f39ee51d79919ab1279c</id>
<content type='text'>
There were two bugs in generating file links (links to "blob" view),
one hidden by the other.  The correct way of generating file link is

	href(action=&gt;"blob", hash_base=&gt;$co{'id'},
	     file_name=&gt;$file);

It was $co{'hash'} (this key does not exist, and therefore this is
undef), and 'hash' instead of 'hash_base'.

To have this fix applied in single place, this commit also reduces
code duplication by saving file link (which is used for line links) in
$file_href.

Reported-by: Thomas Perl &lt;th.perl@gmail.com&gt;
Signed-off-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
