{"thread":{"id":"26111","subject":"[PATCH 1/3] gitweb: add extensions to highlight feature","startedAt":"2010-12-20T19:01:18Z","lastAt":"2010-12-20T23:11:14Z","messageCount":7,"participants":["Sylvain Rabot","Jonathan Nieder","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"158406","messageId":"1292871681-4818-1-git-send-email-sylvain@abstraction.fr","threadId":"26111","inReplyTo":null,"subject":"[PATCH 0/3 v2] minor gitweb modifications","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-12-20T19:01:18Z","receivedAt":"2010-12-20T19:01:18Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"here a three patch serie with minor updates for gitweb based on master.\n\nThis serie has been improved regarding the comments of Jakub Narebski <jnareb@gmail.com>\n\nRegards.\n\nSylvain Rabot (3):\n  gitweb: add extensions to highlight feature\n  gitweb: decorate a bit more remotes\n  gitweb: remove test when closing file descriptor\n\n gitweb/gitweb.perl       |   18 +++++++++---------\n gitweb/static/gitweb.css |    4 ++++\n 2 files changed, 13 insertions(+), 9 deletions(-)\n\n-- \n1.7.3.4.523.g72f0d.dirty\n"},{"id":"158405","messageId":"1292871681-4818-2-git-send-email-sylvain@abstraction.fr","threadId":"26111","inReplyTo":"1292871681-4818-1-git-send-email-sylvain@abstraction.fr","subject":"[PATCH 1/3] gitweb: add extensions to highlight feature","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-12-20T19:01:19Z","receivedAt":"2010-12-20T19:01:19Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"added: sql, php5, phps, bash, zsh, ksh, mk, make\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/gitweb.perl |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d521c93..a37094e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -250,13 +250,14 @@ our %highlight_ext = (\n \t# main extensions, defining name of syntax;\n \t# see files in /usr/share/highlight/langDefs/ directory\n \tmap { $_ => $_ }\n-\t\tqw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl),\n+\t\tqw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),\n \t# alternate extensions, see /etc/highlight/filetypes.conf\n \t'h' => 'c',\n+\tmap { $_ => 'sh'  } qw(bash zsh ksh),\n \tmap { $_ => 'cpp' } qw(cxx c++ cc),\n-\tmap { $_ => 'php' } qw(php3 php4),\n+\tmap { $_ => 'php' } qw(php3 php4 php5 phps),\n \tmap { $_ => 'pl'  } qw(perl pm), # perhaps also 'cgi'\n-\t'mak' => 'make',\n+\tmap { $_ => 'make'} qw(mak mk),\n \tmap { $_ => 'xml' } qw(xhtml html htm),\n );\n \n-- \n1.7.3.4.523.g72f0d.dirty\n"},{"id":"158408","messageId":"1292871681-4818-3-git-send-email-sylvain@abstraction.fr","threadId":"26111","inReplyTo":"1292871681-4818-1-git-send-email-sylvain@abstraction.fr","subject":"[PATCH 2/3] gitweb: decorate a bit more remotes","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-12-20T19:01:20Z","receivedAt":"2010-12-20T19:01:20Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/gitweb.perl       |    8 ++++----\n gitweb/static/gitweb.css |    4 ++++\n 2 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex a37094e..c460f27 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -5127,13 +5127,13 @@ sub git_remote_block {\n \n \tif (defined $fetch) {\n \t\tif ($fetch eq $push) {\n-\t\t\t$urls_table .= format_repo_url(\"URL\", $fetch);\n+\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">URL:</span>\", $fetch);\n \t\t} else {\n-\t\t\t$urls_table .= format_repo_url(\"Fetch URL\", $fetch);\n-\t\t\t$urls_table .= format_repo_url(\"Push URL\", $push) if defined $push;\n+\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">Fetch URL:</span>\", $fetch);\n+\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">Push URL:</span>\", $push) if defined $push;\n \t\t}\n \t} elsif (defined $push) {\n-\t\t$urls_table .= format_repo_url(\"Push URL\", $push);\n+\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">Push URL:</span>\", $push);\n \t} else {\n \t\t$urls_table .= format_repo_url(\"\", \"No remote URL\");\n \t}\ndiff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css\nindex 79d7eeb..ce902f5 100644\n--- a/gitweb/static/gitweb.css\n+++ b/gitweb/static/gitweb.css\n@@ -579,6 +579,10 @@ div.remote {\n \tdisplay: inline-block;\n }\n \n+.bold {\n+\tfont-weight: bold;\n+}\n+\n /* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */\n \n /* Highlighting theme definition: */\n-- \n1.7.3.4.523.g72f0d.dirty\n"},{"id":"158407","messageId":"1292871681-4818-4-git-send-email-sylvain@abstraction.fr","threadId":"26111","inReplyTo":"1292871681-4818-1-git-send-email-sylvain@abstraction.fr","subject":"[PATCH 3/3] gitweb: remove test when closing file descriptor","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-12-20T19:01:21Z","receivedAt":"2010-12-20T19:01:21Z","isPatch":true,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"it happens that closing file descriptor fails whereas\nthe blob is perfectly readable. According to perlman\nthe reasons could be:\n\n   If the file handle came from a piped open, \"close\" will additionally\n   return false if one of the other system calls involved fails, or if the\n   program exits with non-zero status.  (If the only problem was that the\n   program exited non-zero, $! will be set to 0.)  Closing a pipe also waits\n   for the process executing on the pipe to complete, in case you want to\n   look at the output of the pipe afterwards, and implicitly puts the exit\n   status value of that command into $?.\n\n   Prematurely closing the read end of a pipe (i.e. before the process writ-\n   ing to it at the other end has closed it) will result in a SIGPIPE being\n   delivered to the writer.  If the other end can't handle that, be sure to\n   read all the data before closing the pipe.\n\nIn this case we don't mind that close fails.\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\n---\n gitweb/gitweb.perl |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex c460f27..8f0d00e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3450,8 +3450,7 @@ sub run_highlighter {\n \tmy ($fd, $highlight, $syntax) = @_;\n \treturn $fd unless ($highlight && defined $syntax);\n \n-\tclose $fd\n-\t\tor die_error(404, \"Reading blob failed\");\n+\tclose $fd;\n \topen $fd, quote_command(git_cmd(), \"cat-file\", \"blob\", $hash).\" | \".\n \t          quote_command($highlight_bin).\n \t          \" --xhtml --fragment --syntax $syntax |\"\n-- \n1.7.3.4.523.g72f0d.dirty\n"},{"id":"158412","messageId":"20101220200203.GA24163@burratino","threadId":"26111","inReplyTo":"1292871681-4818-3-git-send-email-sylvain@abstraction.fr","subject":"Re: [PATCH 2/3] gitweb: decorate a bit more remotes","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-20T20:02:03Z","receivedAt":"2010-12-20T20:02:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sylvain Rabot wrote:\n\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -5127,13 +5127,13 @@ sub git_remote_block {\n>  \n>  \tif (defined $fetch) {\n>  \t\tif ($fetch eq $push) {\n> -\t\t\t$urls_table .= format_repo_url(\"URL\", $fetch);\n> +\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">URL:</span>\", $fetch);\n>  \t\t} else {\n> -\t\t\t$urls_table .= format_repo_url(\"Fetch URL\", $fetch);\n> -\t\t\t$urls_table .= format_repo_url(\"Push URL\", $push) if defined $push;\n> +\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">Fetch URL:</span>\", $fetch);\n> +\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">Push URL:</span>\", $push) if defined $push;\n\nThis makes the formatting of the remote URLs table inconsistent with\nthe other projects_list table (namely the\n\n\tdescription\t...\n\thomepage URL\t...\n\trepository URL\t...\n\towner\t...\n\tlast change\t...\n\ntable on a repository's summary page).  Is that the right thing\nto do?\n\nIf so, maybe something like the following would make sense.\n\n-- 8< --\nFrom: Sylvain Rabot <sylvain@abstraction.fr>\nDate: Mon, 20 Dec 2010 20:01:20 +0100\nSubject: gitweb: decorate a bit more remotes\n\nPut the text \"URL\" introducing a remote's url in bold and follow it\nwith a colon.  This makes the url list easier to visually scan.\n\nSigned-off-by: Sylvain Rabot <sylvain@abstraction.fr>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThe justification above is totally made up; I have not checked to\nsee whether it makes the table easier or harder to read.  Also:\nuntested.\n\nMaybe the $url part should be esc_url($url)?\n\n gitweb/gitweb.perl       |   16 ++++++++++------\n gitweb/static/gitweb.css |   13 +++++++++++++\n 2 files changed, 23 insertions(+), 6 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d521c93..b870b56 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3862,7 +3862,11 @@ sub git_print_header_div {\n \n sub format_repo_url {\n \tmy ($name, $url) = @_;\n-\treturn \"<tr class=\\\"metadata_url\\\"><td>$name</td><td>$url</td></tr>\\n\";\n+\tmy $row = \"<tr class=\\\"metadata_url\\\">\";\n+\t$row .= ($name eq \"\" ? \"<td></td>\" : \"<td class=\\\"metadata_tag\\\">$name</td>\");\n+\t$row .= \"<td>$url</td>\";\n+\t$row .= \"</tr>\\n\";\n+\treturn $row;\n }\n \n # Group output by placing it in a DIV element and adding a header.\n@@ -5122,7 +5126,7 @@ sub git_remote_block {\n \tmy $fetch = $rdata->{'fetch'};\n \tmy $push = $rdata->{'push'};\n \n-\tmy $urls_table = \"<table class=\\\"projects_list\\\">\\n\" ;\n+\tmy $urls_table = \"<table class=\\\"remote_urls\\\">\\n\" ;\n \n \tif (defined $fetch) {\n \t\tif ($fetch eq $push) {\n@@ -5368,10 +5372,10 @@ sub git_summary {\n \n \tprint \"<div class=\\\"title\\\">&nbsp;</div>\\n\";\n \tprint \"<table class=\\\"projects_list\\\">\\n\" .\n-\t      \"<tr id=\\\"metadata_desc\\\"><td>description</td><td>\" . esc_html($descr) . \"</td></tr>\\n\" .\n-\t      \"<tr id=\\\"metadata_owner\\\"><td>owner</td><td>\" . esc_html($owner) . \"</td></tr>\\n\";\n+\t      \"<tr id=\\\"metadata_desc\\\"><td class=\\\"metadata_tag\\\">description</td><td>\" . esc_html($descr) . \"</td></tr>\\n\" .\n+\t      \"<tr id=\\\"metadata_owner\\\"><td class=\\\"metadata_tag\\\">owner</td><td>\" . esc_html($owner) . \"</td></tr>\\n\";\n \tif (defined $cd{'rfc2822'}) {\n-\t\tprint \"<tr id=\\\"metadata_lchange\\\"><td>last change</td><td>$cd{'rfc2822'}</td></tr>\\n\";\n+\t\tprint \"<tr id=\\\"metadata_lchange\\\"><td class=\\\"metadata_tag\\\">last change</td><td>$cd{'rfc2822'}</td></tr>\\n\";\n \t}\n \n \t# use per project git URL list in $projectroot/$project/cloneurl\n@@ -5390,7 +5394,7 @@ sub git_summary {\n \tif ($show_ctags) {\n \t\tmy $ctags = git_get_project_ctags($project);\n \t\tmy $cloud = git_populate_project_tagcloud($ctags);\n-\t\tprint \"<tr id=\\\"metadata_ctags\\\"><td>Content tags:<br />\";\n+\t\tprint \"<tr id=\\\"metadata_ctags\\\"><td class=\\\"metadata_tag\\\">Content tags:<br />\";\n \t\tprint \"</td>\\n<td>\" unless %$ctags;\n \t\tprint \"<form action=\\\"$show_ctags\\\" method=\\\"post\\\"><input type=\\\"hidden\\\" name=\\\"p\\\" value=\\\"$project\\\" />Add: <input type=\\\"text\\\" name=\\\"t\\\" size=\\\"8\\\" /></form>\";\n \t\tprint \"</td>\\n<td>\" if %$ctags;\ndiff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css\nindex 79d7eeb..feb09e5 100644\n--- a/gitweb/static/gitweb.css\n+++ b/gitweb/static/gitweb.css\n@@ -579,6 +579,19 @@ div.remote {\n \tdisplay: inline-block;\n }\n \n+/*\n+ * <b>URL:</b>\thttp://www.example.com/\n+ * <b>Fetch URL:</b>\thttp://www.example.com/\n+ * <b>Push URL:</b>\thttp://www.example.com/\n+ */\n+table.remote_urls tr.metadata_url td.metadata_tag:after {\n+\tcontent: \":\"\n+}\n+\n+table.remote_urls tr.metadata_url td.metadata_tag {\n+\tfont-weight: bold;\n+}\n+\n /* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */\n \n /* Highlighting theme definition: */\n-- \n1.7.2.3.554.gc9b5c.dirty\n"},{"id":"158418","messageId":"201012210006.13042.jnareb@gmail.com","threadId":"26111","inReplyTo":"20101220200203.GA24163@burratino","subject":"Re: [PATCH 2/3] gitweb: decorate a bit more remotes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-12-20T23:06:11Z","receivedAt":"2010-12-20T23:06:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Mon, 20 Dec 2010, Jonathan Nieder wrote:\n\n> diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css\n> index 79d7eeb..feb09e5 100644\n> --- a/gitweb/static/gitweb.css\n> +++ b/gitweb/static/gitweb.css\n> @@ -579,6 +579,19 @@ div.remote {\n>         display: inline-block;\n>  }\n>  \n> +/*\n> + * <b>URL:</b> http://www.example.com/\n> + * <b>Fetch URL:</b>   http://www.example.com/\n> + * <b>Push URL:</b>    http://www.example.com/\n> + */\n> +table.remote_urls tr.metadata_url td.metadata_tag:after {\n> +       content: \":\"\n> +}\n\nI'd rather not use 'content' (pseudo-)property, as not all web\nbrowsers implement it,... unless of course not having it doesn't\nmake view worse.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"158419","messageId":"m3d3owkplq.fsf@localhost.localdomain","threadId":"26111","inReplyTo":"1292871681-4818-3-git-send-email-sylvain@abstraction.fr","subject":"Re: [PATCH 2/3] gitweb: decorate a bit more remotes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-12-20T23:11:14Z","receivedAt":"2010-12-20T23:11:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sylvain Rabot <sylvain@abstraction.fr> writes:\n\n> -\t\t\t$urls_table .= format_repo_url(\"URL\", $fetch);\n> +\t\t\t$urls_table .= format_repo_url(\"<span class=\\\"bold\\\">URL:</span>\", $fetch);\n\n[...]\n> diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css\n> index 79d7eeb..ce902f5 100644\n> --- a/gitweb/static/gitweb.css\n> +++ b/gitweb/static/gitweb.css\n> @@ -579,6 +579,10 @@ div.remote {\n>  \tdisplay: inline-block;\n>  }\n>  \n> +.bold {\n> +\tfont-weight: bold;\n> +}\n\n<span class=\"bold\"> is not much different from <strong> or <b>;\nI'd rather you use some semantic name for the class, describing\nwhat content it contains rather than what style it uses.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}