From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
A few gitweb cleanups, refactoring, and improvements.
Based on 'master', 1c2a4f5addce479c619057c6cdc841802139982f
First patch in series was sent earlier.
gitweb/gitweb.perl | 80 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 74 insertions(+), 6 deletions(-)
Jakub Narebski:
gitweb: Add support for per project git URLs
gitweb: Refactor printing commit message
gitweb: Fix typo in separation of git_difftree_body
gitweb: Expand href() function to use key as param name for no mapping
gitweb: Added parse_difftree_raw_line function for later use
gitweb: Sort query string parameters in href() function
gitweb: Uniquify version info output, add meta generator in page header
--
Jakub Narebski
Poland
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.
If there is no cloneurl file, concatenation of git base URLs with
project name is used.
This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Aneesh Kumar K.V <redacted>
---
gitweb/gitweb.perl | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
@@ -533,6 +533,16 @@ sub git_get_project_description {return$descr;}+subgit_get_project_url_list{+my$path=shift;++openmy$fd,"$projectroot/$path/cloneurl"orreturnundef;+my@git_project_url_list=map{chomp;$_}<$fd>;+close$fd;++returnwantarray?@git_project_url_list:\@git_project_url_list;+}+subgit_get_projects_list{my@list;
@@ -1697,10 +1707,14 @@ sub git_summary {"<tr><td>description</td><td>".esc_html($descr)."</td></tr>\n"."<tr><td>owner</td><td>$owner</td></tr>\n"."<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n";+# use per project git URL list in $projectroot/$project/cloneurl+# or make project git URL from git base URL and project namemy$url_tag="URL";-foreachmy$git_base_url(@git_base_url_list){-nextunless$git_base_url;-print"<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\n";+my@url_list=git_get_project_url_list($project);+@url_list=map{"$_/$project"}@git_base_url_listunless@url_list;+foreachmy$git_url(@url_list){+nextunless$git_url;+print"<tr><td>$url_tag</td><td>$git_url</td></tr>\n";$url_tag="";}print"</table>\n";
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
Introduction of a href() function to generate an URL for the CGI,
while making it easier to change the encoding of actions into URLs,
changed also the ordering of parameters in query string, and in URL.
This patch tries to bring back old ordering of query string
parameters. Probably it is not worth the cost; this is an RFC.
Signed-off-by: Jakub Narebski <redacted>
---
gitweb/gitweb.perl | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
Adds parse_difftree_raw_line function which parses one line of "raw"
format diff-tree output into a hash.
For later use in git_difftree_body, git_commitdiff and
git_commitdiff_plain, git_search.
Signed-off-by: Jakub Narebski <redacted>
---
gitweb/gitweb.perl | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
Expand href() function to use key name of params hash as a query param
name, if there is no mapping for given key name.
It is now safer to use href(); no errors, but links might not work
correctly if caller didn't provide correct arguments.
Future proofing.
Signed-off-by: Jakub Narebski <redacted>
---
gitweb/gitweb.perl | 143 +++++++++++++++++++++++++++-------------------------
1 files changed, 73 insertions(+), 70 deletions(-)
@@ -204,8 +204,13 @@ sub href(%) {my$href="$my_uri?";$href.=esc_param(join(";",-map{"$mapping{$_}=$params{$_}"}keys%params-));+map{+if(exists$mapping{$_}){+"$mapping{$_}=$params{$_}";+}else{+"$_=$params{$_}";+}+}keys%params));return$href;}
@@ -1174,66 +1179,6 @@ sub git_print_page_path {}}-subgit_print_log{-my$log=shift;--# remove leading empty lines-while(defined$log->[0]&&$log->[0]eq""){-shift@$log;-}--# print log-my$signoff=0;-my$empty=0;-foreachmy$line(@$log){-# print only one empty line-# do not print empty line after signoff-if($lineeq""){-nextif($empty||$signoff);-$empty=1;-}else{-$empty=0;-}-if($line=~m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i){-$signoff=1;-print"<span class=\"signoff\">".esc_html($line)."</span><br/>\n";-}else{-$signoff=0;-printformat_log_line_html($line)."<br/>\n";-}-}-}--subgit_print_simplified_log{-my$log=shift;-my$remove_title=shift;--shift@$logif$remove_title;-# remove leading empty lines-while(defined$log->[0]&&$log->[0]eq""){-shift@$log;-}--# simplify and print log-my$empty=0;-foreachmy$line(@$log){-# remove signoff lines-if($line=~m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i){-next;-}-# print only one empty line-if($lineeq""){-nextif$empty;-$empty=1;-}else{-$empty=0;-}-printformat_log_line_html($line)."<br/>\n";-}-# end with single empty line-print"<br/>\n"unless$empty;-}-## ......................................................................## functions printing large fragments of HTML
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
Separate pretty-printing commit message (comment) into git_print_log
and git_print_simplified_log subroutines. As of now the former is used
in git_commit, the latter in git_log and git_commitdiff.
Signed-off-by: Jakub Narebski <redacted>
---
gitweb/gitweb.perl | 132 ++++++++++++++++++++++++++--------------------------
1 files changed, 67 insertions(+), 65 deletions(-)
@@ -1174,6 +1174,66 @@ sub git_print_page_path {}}+subgit_print_log{+my$log=shift;++# remove leading empty lines+while(defined$log->[0]&&$log->[0]eq""){+shift@$log;+}++# print log+my$signoff=0;+my$empty=0;+foreachmy$line(@$log){+# print only one empty line+# do not print empty line after signoff+if($lineeq""){+nextif($empty||$signoff);+$empty=1;+}else{+$empty=0;+}+if($line=~m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i){+$signoff=1;+print"<span class=\"signoff\">".esc_html($line)."</span><br/>\n";+}else{+$signoff=0;+printformat_log_line_html($line)."<br/>\n";+}+}+}++subgit_print_simplified_log{+my$log=shift;+my$remove_title=shift;++shift@$logif$remove_title;+# remove leading empty lines+while(defined$log->[0]&&$log->[0]eq""){+shift@$log;+}++# simplify and print log+my$empty=0;+foreachmy$line(@$log){+# remove signoff lines+if($line=~m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i){+next;+}+# print only one empty line+if($lineeq""){+nextif$empty;+$empty=1;+}else{+$empty=0;+}+printformat_log_line_html($line)."<br/>\n";+}+# end with single empty line+print"<br/>\n"unless$empty;+}+## ......................................................................## functions printing large fragments of HTML
From: Junio C Hamano <hidden> Date: 2016-06-15 22:42:37
Jakub Narebski [off-list ref] writes:
Expand href() function to use key name of params hash as a query param
name, if there is no mapping for given key name.
It is now safer to use href(); no errors, but links might not work
correctly if caller didn't provide correct arguments.
Future proofing.
I think that is not a "future proofing" but is "sweeping mess
under the rug" ;-).
quoted hunk
@@ -1174,66 +1179,6 @@ sub git_print_page_path { } }-sub git_print_log {- my $log = shift;-- # remove leading empty lines
...
-}
-
-sub git_print_simplified_log {
- my $log = shift;
- my $remove_title = shift;
-
...
- print "<br/>\n" unless $empty;
-}
-
## ......................................................................
## functions printing large fragments of HTML
...
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
On 8/17/06, Junio C Hamano [off-list ref] wrote:
Jakub Narebski [off-list ref] writes:
quoted
Expand href() function to use key name of params hash as a query param
name, if there is no mapping for given key name.
It is now safer to use href(); no errors, but links might not work
correctly if caller didn't provide correct arguments.
Future proofing.
I think that is not a "future proofing" but is "sweeping mess
under the rug" ;-).
At least leave 'if (exists $mapping{$_})' even if you remove the 'else' part.
[...]
Obviously unrelated and probably unplanned revert of [2/7] in
the series, so will not apply.
Ooops, sorry, I haven't noticed this... Very unplanned.
--
Jakub Narebski
From: David Rientjes <rientjes@google.com> Date: 2016-06-15 22:42:37
On Thu, 17 Aug 2006, Jakub Narebski wrote:
It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.
If there is no cloneurl file, concatenation of git base URLs with
project name is used.
This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Aneesh Kumar K.V <redacted>
Signed-off-by: David Rientjes <rientjes@google.com>