gitweb: Split gitweb into modules
cover gitweb: Split gitweb into modules
The patch series is based on 'pu' branch.
10 patches out of the 11 patches in this patch series split gitweb into several small sized modules which is one of the goal of my GSoC's project.
The first patch of this patch series is for fixing esc_url function which is previously missed by commit 425e225.
The second patch is produced by my commit ammend to jakub nareski's initial commit to prepare splitting of gitweb in the message-id:
http://mid.gmane.org/[email protected]
There is a small ammendment to that patch.
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(mod)'
is changed to
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir $(mod))';) because it is better if we gave 'dir $(mod)' as the target for install command rather than '$(mod)' because it may cause problems in the future when gitweblibdir is used and the modules are installed elsewhere rather than in /use/share/gitweb.
The modules created and being used by Gitweb are
Gitweb::Git
Gitweb::Config
Gitweb::Request
Gitweb::Escape
Gitweb::RepoConfig
Gitweb::View
Gitweb::Util
Gitweb::Format
Gitweb::Parse
shortlog:
=======
1. gitweb: fix esc_url
The custom CGI escaping done in esc_url failed to escape UTF-8 properly. Fix by using CGI::escape on each sequence of matched characters instead of sprintf()ing a custom escaping for each byte.
Additionally, the space -> + escape was being escaped due to greedy matching on the first substitution. Fix by adding space to the list of characters not handled on the first substitution.
Finally, remove an unnecessary escaping of the + sign.
commit 425e225 has missed fixing esc_url.
2. gitweb: Prepare for splitting gitweb
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in 'lib/' subdirectory, by adding
use lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
3. gitweb: Create Gitweb::Git module
Create a Gitweb::Git module in 'gitweb/lib/Gitweb/Git.pm' to deal with running git commands (and also processing output of git commands with external programs) from gitweb.
This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies. That is why it includes $GIT variable, even though this variable is configured during building gitweb. On the other hand $GIT is more about git configuration, than gitweb configuration.
Subroutines moved:
evaluate_git_version
git_cmd
quote_command
Update gitweb/Makefile to install Gitweb::Git module alongside gitweb
4. gitweb: Create Gitweb::Config module
Create Gitweb::Config module in 'gitweb/lib/Gitweb/Config.pm' to store all the configuration variables and subroutines regarding the gitweb.perl script.
This module depends only on $git_dir from Gitweb::Git and includes most of the configuration related variables and subroutines (Including those required for configuration of gitweb features)
Subroutines moved:
evaluate_gitweb_config
configure_gitweb_features
filter_snapshot_fmts
gitweb_get_feature
gitweb_check_feature
Update gitweb/Makefile to install Gitweb::Config module alongside gitweb
5. gitweb: Create Gitweb::Request module
Create a Gitweb::Request module in 'gitweb/lib/Gitweb/Request.pm' to store and handle all the cgi params and related variables regarding the gitweb.perl script.
This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies.
validate_project and validate_action can't be included in this module due to unmet dependencies
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refname
Update gitweb/Makefile to install Gitweb::Request module alongside gitweb
6. gitweb: Create Gitweb::Escape module
Create a Gitweb::Escape module in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.
This module imports $fallback_encoding variable from Gitweb::Config module to use it in sub 'to_utf8'
Subroutines moved:
to_utf8 esc_param esc_url esc_html esc_path quot_cec quot_upr unquote untabify
Update gitweb/Makefile to install Gitweb::Escape module alongside gitweb
7. gitweb: Create Gitweb::RepoConfig module
Create a Gitweb::RepoConfig module in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.
This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
It also include subroutines regarding project_list and it's handling.
Subroutines moved:
check_head_link
check_export_ok
hash_set_multi
git_parse_project_config
config_to_bool
config_to_int
config_to_multi
git_get_project_config
git_get_project_description
git_get_project_ctags
git_populate_project_tagcloud
git_show_project_tagcloud
git_get_project_url_list
git_get_projects_list
git_get_project_list_from_file
git_get_project_owner
get_file_owner
project_in_list
Update gitweb/Makefile to install Gitweb::RepoConfig module alongside gitweb
8. gitweb: Create Gitweb::View module
Create Gitweb::View module in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies
Subroutines moved:
href
chop_str
chop_and_escape_str
age_class
age_string
S_ISGITLINK
mode_str
file_type
file_type_long
get_page_title
git_header_html
git_footer_html
die_error
git_print_page_nav
format_paging_nav
get_feed_info
insert_file
git_print_header_div
print_local_time
format_local_time
git_print_page_path
git_get_link_target
normalize_link_target
git_print_tree_entry
print_sort_th
format_sort_th
Update 'gitweb/Makefile' to install Gitweb::View alongside gitweb.
9. gitweb: Create Gitweb::Util module
Create Gitweb::Util module in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.
This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash
git_get_full_hash
git_get_short_hash
git_get_hash
git_get_type
git_get_hash_by_path
git_get_path_by_hash
git_get_last_activity
git_get_references
git_get_rev_name_tags
git_get_heads_list
git_get_tags_list
mimetype_guess_file
mimetype_guess
blob_mimetype
blob_contenttype
guess_file_syntax
run_highlighter
fill_from_file_info
is_deleted
is_patch_split
Update 'gitweb/Makefile' to install Gitweb::Util alongside gitweb.
10. gitweb: Create Gitweb::Format module
Create Gitweb::Format module in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.
This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Subroutines moved:
format_log_line_html
format_ref_marker
format_subject_html
picon_url
gravatar_url
git_get_avatar
format_search_author
format_author_html
format_git_diff_header_line
format_extended_diff_header_line
format_diff_from_to_header
format_diff_cc_simplified
format_diff_line
format_snapshot_links
Update 'gitweb/Makefile' to install Gitweb::Format alongside gitweb.
11. gitweb: Create Gitweb::Parse module
Create Gitweb::Parse module in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.
This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Subroutines moved:
parse_date
parse_tag
parse_commit_text
parse_commit
parse_commits
parse_difftree_raw_line
parsed_difftree_line
parse_ls_tree_line
parse_from_to_diffinfo
Update 'gitweb/Makefile' to install Gitweb::Parse alongside gitweb.
Pavan Kumar Sunkara (11):
gitweb: fix esc_url
gitweb: Prepare for splitting gitweb
gitweb: Create Gitweb::Git module
gitweb: Create Gitweb::Config module
gitweb: Create Gitweb::Request module
gitweb: Create Gitweb::Escape module
gitweb: Create Gitweb::RepoConfig module
gitweb: Create Gitweb::View module
gitweb: Create Gitweb::Util module
gitweb: Create Gitweb::Format module
gitweb: Create Gitweb::Parse module
gitweb/Makefile | 14 + gitweb/gitweb.perl | 3855 +++------------------------------------ gitweb/lib/Gitweb/Config.pm | 498 +++++ gitweb/lib/Gitweb/Escape.pm | 175 ++ gitweb/lib/Gitweb/Format.pm | 537 ++++++ gitweb/lib/Gitweb/Git.pm | 48 + gitweb/lib/Gitweb/Parse.pm | 378 ++++ gitweb/lib/Gitweb/RepoConfig.pm | 424 +++++ gitweb/lib/Gitweb/Request.pm | 153 ++ gitweb/lib/Gitweb/Util.pm | 447 +++++ gitweb/lib/Gitweb/View.pm | 1022 +++++++++++ 11 files changed, 3909 insertions(+), 3642 deletions(-) create mode 100644 gitweb/lib/Gitweb/Config.pm create mode 100644 gitweb/lib/Gitweb/Escape.pm create mode 100644 gitweb/lib/Gitweb/Format.pm create mode 100644 gitweb/lib/Gitweb/Git.pm create mode 100644 gitweb/lib/Gitweb/Parse.pm create mode 100644 gitweb/lib/Gitweb/RepoConfig.pm create mode 100644 gitweb/lib/Gitweb/Request.pm create mode 100644 gitweb/lib/Gitweb/Util.pm create mode 100644 gitweb/lib/Gitweb/View.pm
PATCH 1/11 gitweb: fix esc_url
The custom CGI escaping done in esc_url failed to escape UTF-8 properly. Fix by using CGI::escape on each sequence of matched characters instead of sprintf()ing a custom escaping for each byte.
Additionally, the space -> + escape was being escaped due to greedy matching on the first substitution. Fix by adding space to the list of characters not handled on the first substitution.
Finally, remove an unnecessary escaping of the + sign.
commit 425e225 has missed fixing esc_url.
--- gitweb/gitweb.perl | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +1 -2
@@ -1322,8 +1322,7 @@ sub esc_param { sub esc_url { my $str = shift; return undef unless defined $str; - $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&=])/sprintf("%%%02X", ord($1))/eg; - $str =~ s/\+/%2B/g; + $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&= ]+)/CGI::escape($1)/eg; $str =~ s/ /\+/g; return $str; }
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 2/11 gitweb: Prepare for splitting gitweb
In reply to Pavan Kumar SunkaraFrom: Jakub Narebski <[email protected]>
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in 'lib/' subdirectory, by adding
use lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
--- gitweb/Makefile | 3 +++ gitweb/gitweb.perl | 9 +++++++++ 2 files changed, 12 insertions(+), 0 deletions(-)
gitweb/Makefile +3 -0
@@ -55,6 +55,7 @@ PERL_PATH ?= /usr/bin/perl bindir_SQ = $(subst ','\'',$(bindir))#' gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' +gitweblibdir_SQ = $(subst ','\'',$(gitwebdir)/lib)#' SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
@@ -150,6 +151,8 @@ install: all $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' + $(foreach dir,$(sort $(dir $(GITWEB_MODULES))),test -d '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir)' || $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir)';) + $(foreach mod,$(GITWEB_MODULES),$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir $(mod))';) ### Cleaning rules
gitweb/gitweb.perl +9 -0
@@ -9,6 +9,14 @@ use strict; use warnings; + +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; + use CGI qw(:standard :escapeHTML -nosticky); use CGI::Util qw(unescape); use CGI::Carp qw(fatalsToBrowser set_message);
@@ -16,6 +24,7 @@ use Encode; use Fcntl ':mode'; use File::Find qw(); use File::Basename qw(basename); + binmode STDOUT, ':utf8'; our $t0;
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 3/11 gitweb: Create Gitweb::Git module
In reply to Pavan Kumar SunkaraCreate a Gitweb::Git module in 'gitweb/lib/Gitweb/Git.pm' to deal with running git commands (and also processing output of git commands with external programs) from gitweb.
This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies. That is why it includes $GIT variable, even though this variable is configured during building gitweb. On the other hand $GIT is more about git configuration, than gitweb configuration.
Subroutines moved:
evaluate_git_version
git_cmd
quote_command
Update gitweb/Makefile to install Gitweb::Git module alongside gitweb
--- gitweb/Makefile | 3 ++ gitweb/gitweb.perl | 35 ++++---------------------------- gitweb/lib/Gitweb/Git.pm | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 gitweb/lib/Gitweb/Git.pm
gitweb/Makefile +3 -0
@@ -111,6 +111,9 @@ endif GITWEB_FILES += static/git-logo.png static/git-favicon.png +# Modules: Gitweb::* +GITWEB_MODULES += lib/Gitweb/Git.pm + GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_BINDIR++|$(bindir)|g' \
gitweb/gitweb.perl +5 -30
@@ -27,11 +27,12 @@ use File::Basename qw(basename); binmode STDOUT, ':utf8'; +use Gitweb::Git; + our $t0; if (eval { require Time::HiRes; 1; }) { $t0 = [Time::HiRes::gettimeofday()]; } -our $number_of_git_cmds = 0; BEGIN { CGI->compile() if $ENV{'MOD_PERL'};
@@ -75,9 +76,8 @@ sub evaluate_uri { our $home_link = $my_uri || "/"; } -# core git executable to use -# this can just be "git" if your webserver has a sensible PATH -our $GIT = "++GIT_BINDIR++/git"; +# $GIT is from Gitweb::Git +$GIT = "++GIT_BINDIR++/git"; # absolute fs-path which will be prepended to the project path #our $projectroot = "/pub/scm";
@@ -482,7 +482,6 @@ sub gitweb_get_feature { $feature{$name}{'override'}, @{$feature{$name}{'default'}}); # project specific override is possible only if we have project - our $git_dir; # global variable, declared later if (!$override || !defined $git_dir) { return @defaults; }
@@ -616,13 +615,6 @@ sub get_loadavg { return 0; } -# version of the core git binary -our $git_version; -sub evaluate_git_version { - our $git_version = qx("$GIT" --version) =~ m/git version (.*)$/ ? $1 : "unknown"; - $number_of_git_cmds++; -} - sub check_loadavg { if (defined $maxload && get_loadavg() > $maxload) { die_error(503, "The load average on the server is too high");
@@ -972,10 +964,8 @@ sub evaluate_and_validate_params { } } -# path to the current git repository -our $git_dir; sub evaluate_git_dir { - our $git_dir = "$projectroot/$project" if $project; + $git_dir = "$projectroot/$project" if $project; } our (@snapshot_fmts, $git_avatar);
@@ -2230,21 +2220,6 @@ sub get_feed_info { ## ---------------------------------------------------------------------- ## git utility subroutines, invoking git commands -# returns path to the core git executable and the --git-dir parameter as list -sub git_cmd { - $number_of_git_cmds++; - return $GIT, '--git-dir='.$git_dir; -} - -# quote the given arguments for passing them to the shell -# quote_command("command", "arg 1", "arg with ' and ! characters") -# => "'command' 'arg 1' 'arg with '\'' and '\!' characters'" -# Try to avoid using this function wherever possible. -sub quote_command { - return join(' ', - map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ ); -} - # get HEAD ref of given project as hash sub git_get_head_hash { return git_get_full_hash(shift, 'HEAD');
gitweb/lib/Gitweb/Git.pm new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 4/11 gitweb: Create Gitweb::Config module
In reply to Pavan Kumar SunkaraCreate Gitweb::Config module in 'gitweb/lib/Gitweb/Config.pm' to store all the configuration variables and subroutines regarding the gitweb.perl script.
This module depends only on $git_dir from Gitweb::Git and includes most of the configuration related variables and subroutines (Including those required for configuration of gitweb features)
Subroutines moved:
evaluate_gitweb_config
configure_gitweb_features
filter_snapshot_fmts
gitweb_get_feature
gitweb_check_feature
Update gitweb/Makefile to install Gitweb::Config module alongside gitweb
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 495 ++---------------------------------------- gitweb/lib/Gitweb/Config.pm | 498 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 522 insertions(+), 472 deletions(-) create mode 100644 gitweb/lib/Gitweb/Config.pm
gitweb/Makefile +1 -0
@@ -113,6 +113,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png # Modules: Gitweb::* GITWEB_MODULES += lib/Gitweb/Git.pm +GITWEB_MODULES += lib/Gitweb/Config.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +23 -472
538 lines not on this page · raw message
gitweb/lib/Gitweb/Config.pm new file +498 -0
498 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 5/11 gitweb: Create Gitweb::Request module
In reply to Pavan Kumar SunkaraCreate a Gitweb::Request module in 'gitweb/lib/Gitweb/Request.pm' to store and handle all the cgi params and related variables regarding the gitweb.perl script.
This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies.
validate_project and validate_action can't be included in this module due to unmet dependencies
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refname
Update gitweb/Makefile to install Gitweb::Request module alongside gitweb
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 163 ++++-------------------------------------- gitweb/lib/Gitweb/Request.pm | 153 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 149 deletions(-) create mode 100644 gitweb/lib/Gitweb/Request.pm
gitweb/Makefile +1 -0
@@ -114,6 +114,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png # Modules: Gitweb::* GITWEB_MODULES += lib/Gitweb/Git.pm GITWEB_MODULES += lib/Gitweb/Config.pm +GITWEB_MODULES += lib/Gitweb/Request.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +14 -149
273 lines not on this page · raw message
gitweb/lib/Gitweb/Request.pm new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 6/11 gitweb: Create Gitweb::Escape module
In reply to Pavan Kumar SunkaraCreate a Gitweb::Escape module in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.
This module imports $fallback_encoding variable from Gitweb::Config module to use it in sub 'to_utf8'
Subroutines moved:
to_utf8 esc_param esc_url esc_html esc_path quot_cec quot_upr unquote untabify
Update gitweb/Makefile to install Gitweb::Escape module alongside gitweb
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 156 +-------------------------------------- gitweb/lib/Gitweb/Escape.pm | 175 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+), 155 deletions(-) create mode 100644 gitweb/lib/Gitweb/Escape.pm
gitweb/Makefile +1 -0
@@ -115,6 +115,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png GITWEB_MODULES += lib/Gitweb/Git.pm GITWEB_MODULES += lib/Gitweb/Config.pm GITWEB_MODULES += lib/Gitweb/Request.pm +GITWEB_MODULES += lib/Gitweb/Escape.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -155
174 lines not on this page · raw message
gitweb/lib/Gitweb/Escape.pm new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 7/11 gitweb: Create Gitweb::RepoConfig module
In reply to Pavan Kumar SunkaraCreate a Gitweb::RepoConfig module in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.
This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
It also include subroutines regarding project_list and it's handling.
Subroutines moved:
check_head_link
check_export_ok
hash_set_multi
git_parse_project_config
config_to_bool
config_to_int
config_to_multi
git_get_project_config
git_get_project_description
git_get_project_ctags
git_populate_project_tagcloud
git_show_project_tagcloud
git_get_project_url_list
git_get_projects_list
git_get_project_list_from_file
git_get_project_owner
get_file_owner
project_in_list
Update gitweb/Makefile to install Gitweb::RepoConfig module alongside gitweb
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 400 +------------------------------------ gitweb/lib/Gitweb/RepoConfig.pm | 424 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 426 insertions(+), 399 deletions(-) create mode 100644 gitweb/lib/Gitweb/RepoConfig.pm
gitweb/Makefile +1 -0
@@ -116,6 +116,7 @@ GITWEB_MODULES += lib/Gitweb/Git.pm GITWEB_MODULES += lib/Gitweb/Config.pm GITWEB_MODULES += lib/Gitweb/Request.pm GITWEB_MODULES += lib/Gitweb/Escape.pm +GITWEB_MODULES += lib/Gitweb/RepoConfig.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -399
442 lines not on this page · raw message
gitweb/lib/Gitweb/RepoConfig.pm new file +424 -0
424 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 8/11 gitweb: Create Gitweb::View module
In reply to Pavan Kumar SunkaraCreate Gitweb::View module in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies
Subroutines moved:
href
chop_str
chop_and_escape_str
age_class
age_string
S_ISGITLINK
mode_str
file_type
file_type_long
get_page_title
git_header_html
git_footer_html
die_error
git_print_page_nav
format_paging_nav
get_feed_info
insert_file
git_print_header_div
print_local_time
format_local_time
git_print_page_path
git_get_link_target
normalize_link_target
git_print_tree_entry
print_sort_th
format_sort_th
Update 'gitweb/Makefile' to install Gitweb::View alongside gitweb.
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 996 +------------------------------------------- gitweb/lib/Gitweb/View.pm | 1022 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1024 insertions(+), 995 deletions(-) create mode 100644 gitweb/lib/Gitweb/View.pm
gitweb/Makefile +1 -0
@@ -117,6 +117,7 @@ GITWEB_MODULES += lib/Gitweb/Config.pm GITWEB_MODULES += lib/Gitweb/Request.pm GITWEB_MODULES += lib/Gitweb/Escape.pm GITWEB_MODULES += lib/Gitweb/RepoConfig.pm +GITWEB_MODULES += lib/Gitweb/View.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -995
1,053 lines not on this page · raw message
gitweb/lib/Gitweb/View.pm new file +1022 -0
1,022 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 9/11 gitweb: Create Gitweb::Util module
In reply to Pavan Kumar SunkaraCreate Gitweb::Util module in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.
This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash
git_get_full_hash
git_get_short_hash
git_get_hash
git_get_type
git_get_hash_by_path
git_get_path_by_hash
git_get_last_activity
git_get_references
git_get_rev_name_tags
git_get_heads_list
git_get_tags_list
mimetype_guess_file
mimetype_guess
blob_mimetype
blob_contenttype
guess_file_syntax
run_highlighter
fill_from_file_info
is_deleted
is_patch_split
Update 'gitweb/Makefile' to install Gitweb::Util alongside gitweb.
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 420 +------------------------------------------ gitweb/lib/Gitweb/Util.pm | 447 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 449 insertions(+), 419 deletions(-) create mode 100644 gitweb/lib/Gitweb/Util.pm
gitweb/Makefile +1 -0
@@ -118,6 +118,7 @@ GITWEB_MODULES += lib/Gitweb/Request.pm GITWEB_MODULES += lib/Gitweb/Escape.pm GITWEB_MODULES += lib/Gitweb/RepoConfig.pm GITWEB_MODULES += lib/Gitweb/View.pm +GITWEB_MODULES += lib/Gitweb/Util.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -419
444 lines not on this page · raw message
gitweb/lib/Gitweb/Util.pm new file +447 -0
447 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 10/11 gitweb: Create Gitweb::Format module
In reply to Pavan Kumar SunkaraCreate Gitweb::Format module in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.
This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Subroutines moved:
format_log_line_html
format_ref_marker
format_subject_html
picon_url
gravatar_url
git_get_avatar
format_search_author
format_author_html
format_git_diff_header_line
format_extended_diff_header_line
format_diff_from_to_header
format_diff_cc_simplified
format_diff_line
format_snapshot_links
Update 'gitweb/Makefile' to install Gitweb::Format alongside gitweb.
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 512 +---------------------------------------- gitweb/lib/Gitweb/Format.pm | 537 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 539 insertions(+), 511 deletions(-) create mode 100644 gitweb/lib/Gitweb/Format.pm
gitweb/Makefile +1 -0
@@ -119,6 +119,7 @@ GITWEB_MODULES += lib/Gitweb/Escape.pm GITWEB_MODULES += lib/Gitweb/RepoConfig.pm GITWEB_MODULES += lib/Gitweb/View.pm GITWEB_MODULES += lib/Gitweb/Util.pm +GITWEB_MODULES += lib/Gitweb/Format.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -511
524 lines not on this page · raw message
gitweb/lib/Gitweb/Format.pm new file +537 -0
537 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 11/11 gitweb: Create Gitweb::Parse module
In reply to Pavan Kumar SunkaraCreate Gitweb::Parse module in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.
This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Subroutines moved:
parse_date
parse_tag
parse_commit_text
parse_commit
parse_commits
parse_difftree_raw_line
parsed_difftree_line
parse_ls_tree_line
parse_from_to_diffinfo
Update 'gitweb/Makefile' to install Gitweb::Parse alongside gitweb.
--- gitweb/Makefile | 1 + gitweb/gitweb.perl | 356 +----------------------------------------- gitweb/lib/Gitweb/Parse.pm | 378 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 380 insertions(+), 355 deletions(-) create mode 100644 gitweb/lib/Gitweb/Parse.pm
gitweb/Makefile +1 -0
@@ -120,6 +120,7 @@ GITWEB_MODULES += lib/Gitweb/RepoConfig.pm GITWEB_MODULES += lib/Gitweb/View.pm GITWEB_MODULES += lib/Gitweb/Util.pm GITWEB_MODULES += lib/Gitweb/Format.pm +GITWEB_MODULES += lib/Gitweb/Parse.pm GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
gitweb/gitweb.perl +1 -355
368 lines not on this page · raw message
gitweb/lib/Gitweb/Parse.pm new file +378 -0
378 lines not on this page · raw message
Signature · 1 line
1.7.1.454.g276eb9.dirty
PATCH 1/1 gitweb: Add support for enabling 'write' feature
In reply to Pavan Kumar SunkaraProvide $feature{'write'} to enable the 'write' functionalities for gitweb. While outputting HTML it checks for gitweb_check_feature('write') and if it's enabled, proper links will appear along with the HTML divs.
---
This patch is based on my previous patch series.
http://mid.gmane.org/[email protected]
And this is my first patch in the preparation for integration of write functionality into gitweb.
gitweb/lib/Gitweb/Config.pm | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
gitweb/lib/Gitweb/Config.pm +11 -0
@@ -203,6 +203,17 @@ our %feature = ( # (an array) or gitweb_check_feature(<feature>) to check if <feature> # is enabled + # Enable the 'write' functionalities for gitweb. While outputting HTML + # it checks for gitweb_check_feature('write') and if it's enabled, + # proper links will appear along with the HTML divs. + + # To enable system wide have in $GITWEB_CONFIG + # $feature{'write'}{'default'} = [1]; + # Project specific override is not supported. + 'write' => { + 'override' => 0, + 'default' => [0]}, + # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive.
Signature · 1 line
1.7.1.454.g6bbe9.dirty
Re: [PATCH GSoC] gitweb: Add support for enabling 'write' feature
Quoted 10 lines · Pavan Kumar Sunkara
Provide $feature{'write'} to enable the 'write' functionalities for gitweb. While outputting HTML it checks for
gitweb_check_feature('write')and if it's enabled, proper links will appear along with the HTML divs.Signed-off-by Pavan Kumar Sunkara <[email protected]>---
This patch is based on my previous patch series.
http://mid.gmane.org/[email protected]
It looks a bit like this email is send by accident...
Quoted 17 lines
And this is my first patch in the preparation for integration of write functionality into gitweb.
gitweb/lib/Gitweb/Config.pm | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)gitweb/lib/Gitweb/Config.pm +3
-0@@ -203,6 +203,17 @@ our %feature = ( # (an array) or gitweb_check_feature(<feature>) to check if <feature> # is enabled + # Enable the 'write' functionalities for gitweb. While outputting HTML + # it checks for gitweb_check_feature('write') and if it's enabled, + # proper links will appear along with the HTML divs.
gitweb/lib/Gitweb/Config.pm our %feature = ( · line 218
Quoted 10 lines
gitweb/lib/Gitweb/Config.pm +8
-0+ + # To enable system wide have in $GITWEB_CONFIG + # $feature{'write'}{'default'} = [1]; + # Project specific override is not supported. + 'write' => { + 'override' => 0, + 'default' => [0]}, + # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive.
...as there is nothing non-trivial in there.
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCH GSoC] gitweb: Add support for enabling 'write' feature
2010/6/22 Jakub Narebski <[email protected]>:
Quoted 45 lines · Pavan Kumar Sunkara
Quoted 11 lines
Provide $feature{'write'} to enable the 'write' functionalities for gitweb. While outputting HTML it checks for
gitweb_check_feature('write')and if it's enabled, proper links will appear along with the HTML divs.Signed-off-by Pavan Kumar Sunkara <[email protected]>---
This patch is based on my previous patch series.
http://mid.gmane.org/[email protected]It looks a bit like this email is send by accident...
Quoted 17 lines
And this is my first patch in the preparation for integration of write functionality into gitweb.
gitweb/lib/Gitweb/Config.pm | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)gitweb/lib/Gitweb/Config.pm +3
-0@@ -203,6 +203,17 @@ our %feature = ( # (an array) or gitweb_check_feature(<feature>) to check if <feature> # is enabled + # Enable the 'write' functionalities for gitweb. While outputting HTML + # it checks for gitweb_check_feature('write') and if it's enabled, + # proper links will appear along with the HTML divs.gitweb/lib/Gitweb/Config.pm our %feature = ( · line 218
Quoted 10 lines
gitweb/lib/Gitweb/Config.pm +8
-0+ + # To enable system wide have in $GITWEB_CONFIG + # $feature{'write'}{'default'} = [1]; + # Project specific override is not supported. + 'write' => { + 'override' => 0, + 'default' => [0]}, + # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive....as there is nothing non-trivial in there.
Quoted 4 lines
--
Jakub Narebski
Poland
But don't u think it would be like a small starting patch.
Thanks,
Pavan.
Re: [PATCH GSoC] gitweb: Add support for enabling 'write' feature
Quoted 33 lines · Pavan Kumar Sunkara
2010/6/22 Jakub Narebski <[email protected]>:
Quoted 16 lines · Pavan Kumar Sunkara
Quoted 15 lines
Provide $feature{'write'} to enable the 'write' functionalities for gitweb. While outputting HTML it checks for
gitweb_check_feature('write')and if it's enabled, proper links will appear along with the HTML divs.Signed-off-by Pavan Kumar Sunkara <[email protected]>gitweb/lib/Gitweb/Config.pm +0
-0@@ -203,6 +203,17 @@ our %feature = ( # (an array) or gitweb_check_feature(<feature>) to check if <feature> # is enabledQuoted 15 lines
gitweb/lib/Gitweb/Config.pm our %feature = ( · line 218
Quoted 13 lines
gitweb/lib/Gitweb/Config.pm +11
-0+ # Enable the 'write' functionalities for gitweb. While outputting HTML + # it checks for gitweb_check_feature('write') and if it's enabled, + # proper links will appear along with the HTML divs. + + # To enable system wide have in $GITWEB_CONFIG + # $feature{'write'}{'default'} = [1]; + # Project specific override is not supported. + 'write' => { + 'override' => 0, + 'default' => [0]}, + # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive....as there is nothing non-trivial in there.
Quoted 1 line
But don't u think it would be like a small starting patch.
There is staring small, and there is too small.
You don't provide _any_ write functionality here, or even any authorization framework for write functionality, like checking if we are on localhost.
Signature · 2 lines
Jakub Narebski Poland
Thank you very much for providing such detailed cover letter. It makes commenting on this series much easier.
Quoted 1 line · Pavan Kumar Sunkara
The patch series is based on 'pu' branch.
You should probably say also which commit (which branch) this depends on, rather than blanket 'pu'.
Quoted 6 lines
10 patches out of the 11 patches in this patch series split gitweb into several small sized modules which is one of the goal of my GSoC's project.
The first patch of this patch series is for fixing
esc_urlfunction which is previously missed by commit 425e225.
I think it would be better to send this patch separately, standalone (not in series), based on 'master' or even 'maint' to have it applied, and not being held back by being in this series. This is pure bugfix for a (rare) bug.
Quoted 5 lines
The second patch is produced by my commit amend to Jakub Narebski's initial commit to prepare splitting of gitweb in the message-id:
http://mid.gmane.org/[email protected]
Quoted 7 lines
There is a small ammendment to that patch.
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(mod)'
is changed to
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir $(mod))';) because it is better if we gave 'dir $(mod)' as the target for install command rather than '$(mod)' because it may cause problems in the future when gitweblibdir is used and the modules are installed elsewhere rather than in /use/share/gitweb.
Thanks for finding it, and for improving it.
Actually, as long as we have only individual files in $(GITWEB_MODULES), it should not matter. The version before changes used
install [OPTION]... SOURCE DEST
form, and after changes it uses
install [OPTION]... SOURCE... DIRECTORY
with a single SOURCE. So I don't think it is strictly necessary, but it might be a good improvement anyway.
Quoted 11 lines
The modules created and being used by Gitweb are
Gitweb::Git
Gitweb::Config
Gitweb::Request
Gitweb::Escape
Gitweb::RepoConfig
Gitweb::View
Gitweb::Util
Gitweb::Format
Gitweb::Parse
What I would like to see here is a dependency graph, i.e. which modules include (use) which modules, and perhaps also how much this split reduces size of main gitweb.perl file.
Quoted 3 lines
shortlog:
=========
Nitpick: I would say "Table of contents", because shortlog it is not ;-)))
Quoted 7 lines
1. gitweb: fix
esc_urlThe custom CGI escaping done in
esc_urlfailed to escape UTF-8 properly. Fix by usingCGI::escapeon each sequence of matched characters instead of sprintf()ing a custom escaping for each byte.
Quoted 7 lines
Additionally, the space -> + escape was being escaped due to greedy matching on the first substitution. Fix by adding space to the list of characters not handled on the first substitution.
Finally, remove an unnecessary escaping of the + sign.
commit 425e225 has missed fixing
esc_url.
I would probably write this commit message differently, saying that original author (Giuseppe Bilotta) fixed esc_param, but didn't finish fixing this bug by not fixing esc_url, and that this commit finishes it. Probably also use "fix esc_url, use CGI::escape" in subject. But that's me, not you.
Note: the commit is 452e225, not 425e225 !!!
^^ ^^
Quoted 11 lines
2. gitweb: Prepare for splitting gitweb
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in '
lib/' subdirectory, by addinguse lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
It makes adding modules to install very easy, isn't it?
Quoted 5 lines
3. gitweb: Create
Gitweb::GitmoduleCreate a
Gitweb::Gitmodule in 'gitweb/lib/Gitweb/Git.pm' to deal with running git commands (and also processing output of git commands with external programs) from gitweb.
The "processing output of git commands with external programs" looks a bit strange to me. If it is about quote_command() subroutine, it is more about shell escaping of commands, or about running other programs... but it might be O.K., if what you want to say that quote_command() is used in pipe-ing output of git commands (e.g. git-archive) to other programs (e.g. gzip).
So take the above comment with a bit of salt...
Quoted 7 lines
This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies. That is why it includes $GIT variable, even though this variable is configured during building gitweb. On the other hand $GIT is more about git configuration, than gitweb configuration.
Quoted 6 lines
Subroutines moved:
evaluate_git_version
git_cmd
quote_commandUpdate gitweb/Makefile to install
Gitweb::Gitmodule alongside gitweb
O.K.
Quoted 10 lines
4. gitweb: Create
Gitweb::ConfigmoduleCreate
Gitweb::Configmodule in 'gitweb/lib/Gitweb/Config.pm' to store all the configuration variables and subroutines regarding the gitweb.perl script.This module depends only on $git_dir from
Gitweb::Gitand includes most of the configuration related variables and subroutines (Including those required for configuration of gitweb features).
"Most" meaning what? Which subroutines weren't moved, and why (they should not be in Gitweb::Config, they cannot be moved for technical reasons)?
Quoted 4 lines
Subroutines moved:
evaluate_gitweb_config
configure_gitweb_features
I'm not sure if configure_gitweb_features() should be there, as it is run-once subroutine, about flow of the main program... but perhaps it is O.K. to have it here.
Quoted 5 lines
filter_snapshot_fmts
gitweb_get_feature
gitweb_check_featureUpdate gitweb/Makefile to install
Gitweb::Configmodule alongside gitweb
O.K.
Quoted 11 lines
5. gitweb: Create
Gitweb::RequestmoduleCreate a
Gitweb::Requestmodule in 'gitweb/lib/Gitweb/Request.pm' to store and handle all the cgi params and related variables regarding the gitweb.perl script.This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies.
validate_projectandvalidate_actioncan't be included in this module due to unmet dependencies.
What unment dependencies? Can it be worked around by changing their signatures to use additional parameters, e.g.:
sub validate_action {
my $input = shift || return undef;
my $actions = shift || return undef;
return undef unless exists $actions->{$input};
return $input;
}But I guess it would be very hard to do the same with validate_project. Also such change might be out of scope for _this_ series.
Quoted 6 lines
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refname
I'm not completly sure if validate_* subroutines should be not separate, as they do require more knowledge about setup, and about git repositories served, than the rest of Gitweb::Request subroutines...
Quoted 2 lines
Update gitweb/Makefile to install
Gitweb::Requestmodule alongside gitweb
O.K.
Quoted 9 lines
6. gitweb: Create
Gitweb::EscapemoduleCreate a
Gitweb::Escapemodule in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.This module imports $fallback_encoding variable from
Gitweb::Configmodule to use it in sub 'to_utf8'
Quoted 8 lines
Subroutines moved:
to_utf8 esc_param esc_url esc_html esc_path quot_cec quot_upr
O.K.
Quoted 1 line
unquote
Shouldn't unquote be in Gitweb::Parse, as contrary to the rest of subroutines is is not about gitweb output escaping/quoting, but about processing (parsing) output of git commands? Perhaps it could even be provate to Gitweb::Parse (i.e. not exported by default)...
Quoted 11 lines
untabify
Update gitweb/Makefile to install
Gitweb::Escapemodule alongside gitweb7. gitweb: Create
Gitweb::RepoConfigmoduleCreate a
Gitweb::RepoConfigmodule in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.
Quoted 5 lines
This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
It also include subroutines regarding
project_listand it's handling.
Why? Is it to not have too many tiny modules, or is simply there no single good place where to put this subroutine?
Quoted 4 lines
Subroutines moved:
check_head_link
check_export_ok
O.K.
Quoted 5 lines
hash_set_multi
config_to_bool
config_to_int
config_to_multi
git_parse_project_config
Hmmm... I think that in the future all the subroutines dealing with reading of gitweb config and making its values available should be encapsulated in a separate module... Git::Config perhaps?
But I guess that is for the future commit.
Quoted 10 lines
git_get_project_config
git_get_project_description
git_get_project_ctags
git_populate_project_tagcloud
git_show_project_tagcloud
git_get_project_url_list
git_get_projects_list
git_get_project_list_from_file
git_get_project_owner
get_file_owner
O.K.
Quoted 1 line
project_in_list
Hmmm...
Quoted 10 lines
Update gitweb/Makefile to install
Gitweb::RepoConfigmodule alongside gitweb8. gitweb: Create
Gitweb::ViewmoduleCreate
Gitweb::Viewmodule in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.
I find that this module looks a bit like a collection of fairly unrelated subroutines at very different levels of abstractions.
I guess that you don't want to split gitweb into too many modules, and splitting gitweb is more of one of steps to final goal of adding write functionality to gitweb, rather than the goal in and of itself. Nevertheless it would be good to be able to immediately know from the description of module what kind of subroutines should be there.
Quoted 5 lines
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies.
Which subroutines and what unmet dependencies?
Quoted 2 lines
Subroutines moved:
Perhaps this list should be grouped in categories, either by separating groups with empty line, or by putting '*' before first subroutine in group, as shown in example below:
Quoted 1 line
href
Hmmm... that's the opposte side of Gitweb::Request, crating rather than parsing gitweb links...
Quoted 1 line
get_feed_info
To be passed to href(); I think it is the only one.
Quoted 2 lines
chop_str
chop_and_escape_str
Those are pure utility functions.
Quoted 2 lines
*
age_class
age_string
Those are about coloring based on relative time and (age_string - not a great name) generating relative time ("nn units ago").
Quoted 2 lines
*
print_local_time
format_local_time
Shouldn't this be in Gitweb::Format? If not, why?
Quoted 4 lines
*
S_ISGITLINK
mode_str
file_type
file_type_long
Those are all about types of files from git-ls-tree and friends, but with single exception of S_ISGITLINK they are about gitweb output side.
Quoted 4 lines
get_page_title
git_header_html
git_footer_html
die_error
Main parts of page.
Quoted 4 lines
*
git_print_page_nav
format_paging_nav
git_print_header_div
git_print_page_path
Fragments of page (used in most of views). This decidely belong to Gitweb::View.
Quoted 1 line
*
insert_file
More of utility function.
Quoted 3 lines
*
git_get_link_target
normalize_link_target
git_print_tree_entry
Should it be here? The *_body subroutines aren't there in Gitweb::View. The *_link_target are utility subroutines for git_print_tree_entry.
Quoted 2 lines
print_sort_th
format_sort_th
Hmmm...
Quoted 2 lines
Update 'gitweb/Makefile' to install
Gitweb::Viewalongside gitweb.
I have my doubts...
Quoted 23 lines
9. gitweb: Create
Gitweb::UtilmoduleCreate
Gitweb::Utilmodule in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash
git_get_full_hash
git_get_short_hash
git_get_hash
git_get_type
git_get_hash_by_path
git_get_path_by_hash
git_get_last_activity
git_get_references
git_get_rev_name_tags
git_get_heads_list
git_get_tags_list
Quoted 8 lines
mimetype_guess_file
mimetype_guess
blob_mimetype
blob_contenttype
guess_file_syntax
fill_from_file_info
is_deleted
is_patch_split
O.K.
Quoted 1 line
run_highlighter
_Perhaps_ with exception of this subroutine.
Quoted 6 lines
Update 'gitweb/Makefile' to install
Gitweb::Utilalongside gitweb.10. gitweb: Create
Gitweb::Formatmodule
Quoted 8 lines
Create
Gitweb::Formatmodule in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Why it depends on Gitweb::View, and not the reverse? I understand why it depends on Gitweb::Config and Gitweb::Escape, and I guess it needs $cgi from Gitweb::Request (or is it something more?).
Quoted 16 lines
Subroutines moved:
format_log_line_html
format_ref_marker
format_subject_html
picon_url
gravatar_url
git_get_avatar
format_search_author
format_author_html
format_git_diff_header_line
format_extended_diff_header_line
format_diff_from_to_header
format_diff_cc_simplified
format_diff_line
format_snapshot_links
O.K., I think.
Quoted 11 lines
Update 'gitweb/Makefile' to install
Gitweb::Formatalongside gitweb.11. gitweb: Create
Gitweb::ParsemoduleCreate
Gitweb::Parsemodule in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Why it depends on Gitweb::View? It is a strange dependency. I understand depending on Gitweb::Git to some extent, I'm not sure if we shouldn't simply move unescape to it instead of requiring Gitweb::Escape (unless there is more: to_utf8 perhaps?), and I understand that Gitweb::Util has some required subroutines.
Quoted 11 lines
Subroutines moved:
parse_date
parse_tag
parse_commit_text
parse_commit
parse_commits
parse_difftree_raw_line
parsed_difftree_line
parse_ls_tree_line
parse_from_to_diffinfo
O.K.
Quoted 17 lines
Update 'gitweb/Makefile' to install
Gitweb::Parsealongside gitweb.Pavan Kumar Sunkara (11):
gitweb: fixesc_url
gitweb: Prepare for splitting gitweb
gitweb: CreateGitweb::Gitmodule
gitweb: CreateGitweb::Configmodule
gitweb: CreateGitweb::Requestmodule
gitweb: CreateGitweb::Escapemodule
gitweb: CreateGitweb::RepoConfigmodule
gitweb: CreateGitweb::Viewmodule
gitweb: CreateGitweb::Utilmodule
gitweb: CreateGitweb::Formatmodule
gitweb: CreateGitweb::Parsemodule
Quoted 2 lines
gitweb/Makefile | 14 + gitweb/gitweb.perl | 3855 +++------------------------------------
Nice!
Quoted 11 lines
gitweb/lib/Gitweb/Config.pm | 498 +++++ gitweb/lib/Gitweb/Escape.pm | 175 ++ gitweb/lib/Gitweb/Format.pm | 537 ++++++ gitweb/lib/Gitweb/Git.pm | 48 + gitweb/lib/Gitweb/Parse.pm | 378 ++++ gitweb/lib/Gitweb/RepoConfig.pm | 424 +++++ gitweb/lib/Gitweb/Request.pm | 153 ++ gitweb/lib/Gitweb/Util.pm | 447 +++++ gitweb/lib/Gitweb/View.pm | 1022 +++++++++++ 11 files changed, 3909 insertions(+), 3642 deletions(-) create mode 100644 gitweb/lib/Gitweb/Config.pm
Quoted 8 lines
create mode 100644 gitweb/lib/Gitweb/Escape.pm create mode 100644 gitweb/lib/Gitweb/Format.pm create mode 100644 gitweb/lib/Gitweb/Git.pm create mode 100644 gitweb/lib/Gitweb/Parse.pm create mode 100644 gitweb/lib/Gitweb/RepoConfig.pm create mode 100644 gitweb/lib/Gitweb/Request.pm create mode 100644 gitweb/lib/Gitweb/Util.pm create mode 100644 gitweb/lib/Gitweb/View.pm
Keep up good work!
Signature · 2 lines
Jakub Narebski Poland
2010/6/22 Jakub Narebski <[email protected]>:
Quoted 41 lines
Thank you very much for providing such detailed cover letter. It makes commenting on this series much easier.
Quoted 1 line · Pavan Kumar Sunkara
The patch series is based on 'pu' branch.
You should probably say also which commit (which branch) this depends on, rather than blanket 'pu'.
Quoted 6 lines
10 patches out of the 11 patches in this patch series split gitweb into several small sized modules which is one of the goal of my GSoC's project.
The first patch of this patch series is for fixing
esc_urlfunction which is previously missed by commit 425e225.I think it would be better to send this patch separately, standalone (not in series), based on 'master' or even 'maint' to have it applied, and not being held back by being in this series. This is pure bugfix for a (rare) bug.
Quoted 5 lines
The second patch is produced by my commit amend to Jakub Narebski's initial commit to prepare splitting of gitweb in the message-id:
http://mid.gmane.org/[email protected]Quoted 7 lines
There is a small ammendment to that patch.
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(mod)'
is changed to
$(INSTALL) -m 644 $(mod) '$(DESTDIR_SQ)$(gitwebdir_SQ)/$(dir $(mod))';) because it is better if we gave 'dir $(mod)' as the target for install command rather than '$(mod)' because it may cause problems in the future when gitweblibdir is used and the modules are installed elsewhere rather than in /use/share/gitweb.Thanks for finding it, and for improving it.
Actually, as long as we have only individual files in $(GITWEB_MODULES), it should not matter. The version before changes used
Quoted 8 lines
install [OPTION]... SOURCE DEST
form, and after changes it uses
install [OPTION]... SOURCE... DIRECTORY
with a single SOURCE. So I don't think it is strictly necessary, but it might be a good improvement anyway.
Thanks.
Quoted 12 lines
Quoted 11 lines
The modules created and being used by Gitweb are
Gitweb::Git
Gitweb::Config
Gitweb::Request
Gitweb::Escape
Gitweb::RepoConfig
Gitweb::View
Gitweb::Util
Gitweb::Format
Gitweb::Parse
Quoted 3 lines
What I would like to see here is a dependency graph, i.e. which modules include (use) which modules, and perhaps also how much this split reduces size of main gitweb.perl file.
The dependency is written in individual commits.
Quoted 21 lines
Quoted 3 lines
shortlog:
=========Nitpick: I would say "Table of contents", because shortlog it is not ;-)))
Quoted 7 lines
1. gitweb: fix
esc_urlThe custom CGI escaping done in
esc_urlfailed to escape UTF-8 properly. Fix by usingCGI::escapeon each sequence of matched characters instead of sprintf()ing a custom escaping for each byte.Quoted 7 lines
Additionally, the space -> + escape was being escaped due to greedy matching on the first substitution. Fix by adding space to the list of characters not handled on the first substitution.
Finally, remove an unnecessary escaping of the + sign.
commit 425e225 has missed fixing
esc_url.
Quoted 8 lines
I would probably write this commit message differently, saying that original author (Giuseppe Bilotta) fixed
esc_param, but didn't finish fixing this bug by not fixingesc_url, and that this commit finishes it. Probably also use "fixesc_url, useCGI::escape" in subject. But that's me, not you.Note: the commit is 452e225, not 425e225 !!!
^^ ^^
ok.
Quoted 7 lines
Quoted 7 lines
2. gitweb: Prepare for splitting gitweb
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in '
lib/' subdirectory, by adding
Quoted 6 lines
Quoted 4 lines
use lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
It makes adding modules to install very easy, isn't it?
yes.
Quoted 6 lines
Quoted 5 lines
3. gitweb: Create
Gitweb::GitmoduleCreate a
Gitweb::Gitmodule in 'gitweb/lib/Gitweb/Git.pm' to deal with running git commands (and also processing output of git commands with external programs) from gitweb.
Quoted 8 lines
The "processing output of git commands with external programs" looks a bit strange to me. If it is about
quote_command()subroutine, it is more about shell escaping of commands, or about running other programs... but it might be O.K., if what you want to say thatquote_command()is used in pipe-ing output of git commands (e.g. git-archive) to other programs (e.g. gzip).So take the above comment with a bit of salt...
actually that message has been written by you itself in one of the earlier threads.
Quoted 22 lines
Quoted 7 lines
This module is intended as standalone module, which does n>ot require (include) other gitweb' modules to avoid circular dependencies. That is why it includes $GIT variable, even though this variable is configured during building gitweb. On the other hand $GIT is more about git configuration, than gitweb configuration.
Quoted 6 lines
Subroutines moved:
evaluate_git_version
git_cmd
quote_commandUpdate gitweb/Makefile to install
Gitweb::Gitmodule alongside gitwebO.K.
Quoted 6 lines
4. gitweb: Create
Gitweb::ConfigmoduleCreate
Gitweb::Configmodule in 'gitweb/lib/Gitweb/Config.pm' to store all the configuration variables and subroutines regarding the gitweb.perl script.
Quoted 8 lines
Quoted 4 lines
This module depends only on $git_dir from
Gitweb::Gitand includes most of the configuration related variables and subroutines (Including those required for configuration of gitweb features)."Most" meaning what? Which subroutines weren't moved, and why (they should not be in
Gitweb::Config, they cannot be moved for technical reasons)?
Yes, due to either unment dependency or circular dependency problem. But no need to worry as they are very small.
Quoted 8 lines
Quoted 4 lines
Subroutines moved:
evaluate_gitweb_config
configure_gitweb_featuresI'm not sure if
configure_gitweb_features()should be there, as it is run-once subroutine, about flow of the main program... but perhaps it is O.K. to have it here.
That's what I thought.
Quoted 23 lines
Quoted 5 lines
filter_snapshot_fmts
gitweb_get_feature
gitweb_check_featureUpdate gitweb/Makefile to install
Gitweb::Configmodule alongside gitwebO.K.
Quoted 11 lines
5. gitweb: Create
Gitweb::RequestmoduleCreate a
Gitweb::Requestmodule in 'gitweb/lib/Gitweb/Request.pm' to store and handle all the cgi params and related variables regarding the gitweb.perl script.This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies.
validate_projectandvalidate_actioncan't be included in this module due to unmet dependencies.What unment dependencies? Can it be worked around by changing their signatures to use additional parameters, e.g.:
Quoted 8 lines
sub
validate_action{
my $input = shift || return undef;
my $actions = shift || return undef;return undef unless exists $actions->{$input}; return $input;
}
Yes. I think we can but don't you think that we need to import $actions everytime we use validate_action.
So, I figured it would be better If i leave it untouched for now.
Quoted 10 lines
But I guess it would be very hard to do the same with
validate_project. Also such change might be out of scope for _this_ series.Quoted 6 lines
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refname
Quoted 3 lines
I'm not completly sure if validate_* subroutines should be not separate, as they do require more knowledge about setup, and about git repositories served, than the rest of
Gitweb::Requestsubroutines...
But they are being used in Gitweb::Request subroutines, so I included them in there.
Quoted 25 lines
Quoted 2 lines
Update gitweb/Makefile to install
Gitweb::Requestmodule alongside gitwebO.K.
Quoted 9 lines
6. gitweb: Create
Gitweb::EscapemoduleCreate a
Gitweb::Escapemodule in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.This module imports $fallback_encoding variable from
Gitweb::Configmodule to use it in sub 'to_utf8'Quoted 8 lines
Subroutines moved:
to_utf8
esc_param
esc_url
esc_html
esc_path
quot_cec
quot_uprO.K.
Quoted 7 lines
Quoted 1 line
unquote
Shouldn't unquote be in
Gitweb::Parse, as contrary to the rest of subroutines is is not about gitweb output escaping/quoting, but about processing (parsing) output of git commands? Perhaps it could even be provate toGitweb::Parse(i.e. not exported by default)...
It would result in circular dependency. So, Escape module is best for it's place.
Quoted 11 lines
Quoted 11 lines
untabify
Update gitweb/Makefile to install
Gitweb::Escapemodule alongside gitweb7. gitweb: Create
Gitweb::RepoConfigmoduleCreate a
Gitweb::RepoConfigmodule in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.
Quoted 8 lines
Quoted 5 lines
This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
It also include subroutines regarding
project_listand it's handling.Why? Is it to not have too many tiny modules, or is simply there no single good place where to put this subroutine?
There is no single good place. Anyhow, as they are regarding project configuration, I thought it would be better place for it.
Quoted 57 lines
Quoted 4 lines
Subroutines moved:
check_head_link
check_export_okO.K.
Quoted 5 lines
hash_set_multi
config_to_bool
config_to_int
config_to_multi
git_parse_project_configHmmm... I think that in the future all the subroutines dealing with reading of gitweb config and making its values available should be encapsulated in a separate module...
Git::Configperhaps?But I guess that is for the future commit.
Quoted 10 lines
git_get_project_config
git_get_project_description
git_get_project_ctags
git_populate_project_tagcloud
git_show_project_tagcloud
git_get_project_url_list
git_get_projects_list
git_get_project_list_from_file
git_get_project_owner
get_file_ownerO.K.
Quoted 1 line
project_in_listHmmm...
Quoted 10 lines
Update gitweb/Makefile to install
Gitweb::RepoConfigmodule alongside gitweb8. gitweb: Create
Gitweb::ViewmoduleCreate
Gitweb::Viewmodule in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.I find that this module looks a bit like a collection of fairly unrelated subroutines at very different levels of abstractions.
I guess that you don't want to split gitweb into too many modules, and splitting gitweb is more of one of steps to final goal of adding write functionality to gitweb, rather than the goal in and of itself. Nevertheless it would be good to be able to immediately know from the description of module what kind of subroutines should be there.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies.
Which subroutines and what unmet dependencies?
action specific HTML divs. They include format_* and parse_* subs.
Quoted 63 lines
Quoted 2 lines
Subroutines moved:
Perhaps this list should be grouped in categories, either by separating groups with empty line, or by putting '*' before first subroutine in group, as shown in example below:
Quoted 1 line
href
Hmmm... that's the opposte side of
Gitweb::Request, crating rather than parsing gitweb links...Quoted 1 line
get_feed_infoTo be passed to
href(); I think it is the only one.Quoted 2 lines
chop_str
chop_and_escape_strThose are pure utility functions.
Quoted 2 lines
*
age_class
age_stringThose are about coloring based on relative time and (
age_string- not a great name) generating relative time ("nn units ago").Quoted 2 lines
*
print_local_time
format_local_timeShouldn't this be in
Gitweb::Format? If not, why?Quoted 4 lines
*
S_ISGITLINK
mode_str
file_type
file_type_longThose are all about types of files from git-ls-tree and friends, but with single exception of
S_ISGITLINKthey are about gitweb output side.Quoted 4 lines
get_page_title
git_header_html
git_footer_html
die_errorMain parts of page.
Quoted 4 lines
*
git_print_page_nav
format_paging_nav
git_print_header_div
git_print_page_pathFragments of page (used in most of views). This decidely belong to
Gitweb::View.Quoted 1 line
*
insert_fileMore of utility function.
Quoted 3 lines
*
git_get_link_target
normalize_link_target
git_print_tree_entry
Quoted 7 lines
Should it be here? The
*_bodysubroutines aren't there inGitweb::View. The*_link_targetare utility subroutines forgit_print_tree_entry.Quoted 2 lines
print_sort_th
format_sort_thHmmm...
Ok.
Quoted 37 lines
Quoted 2 lines
Update 'gitweb/Makefile' to install
Gitweb::Viewalongside gitweb.I have my doubts...
Quoted 23 lines
9. gitweb: Create
Gitweb::UtilmoduleCreate
Gitweb::Utilmodule in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash
git_get_full_hash
git_get_short_hash
git_get_hash
git_get_type
git_get_hash_by_path
git_get_path_by_hash
git_get_last_activity
git_get_references
git_get_rev_name_tags
git_get_heads_list
git_get_tags_listQuoted 8 lines
mimetype_guess_file
mimetype_guess
blob_mimetype
blob_contenttype
guess_file_syntax
fill_from_file_info
is_deleted
is_patch_split
Quoted 5 lines
O.K.
Quoted 1 line
run_highlighter_Perhaps_ with exception of this subroutine.
Well. It was in the utility category in gitweb.perl script. So, I added it in here without giving much thought.
Quoted 10 lines
Quoted 10 lines
Update 'gitweb/Makefile' to install
Gitweb::Utilalongside gitweb.10. gitweb: Create
Gitweb::FormatmoduleCreate
Gitweb::Formatmodule in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.
Quoted 8 lines
Quoted 4 lines
This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Why it depends on
Gitweb::View, and not the reverse? I understand why it depends onGitweb::ConfigandGitweb::Escape, and I guess it needs $cgi fromGitweb::Request(or is it something more?).
$hash, $hash_parent also.
Quoted 29 lines
Quoted 16 lines
Subroutines moved:
format_log_line_html
format_ref_marker
format_subject_html
picon_url
gravatar_url
git_get_avatar
format_search_author
format_author_html
format_git_diff_header_line
format_extended_diff_header_line
format_diff_from_to_header
format_diff_cc_simplified
format_diff_line
format_snapshot_linksO.K., I think.
Quoted 10 lines
Update 'gitweb/Makefile' to install
Gitweb::Formatalongside gitweb.11. gitweb: Create
Gitweb::ParsemoduleCreate
Gitweb::Parsemodule in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.
Quoted 7 lines
Quoted 1 line
This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Why it depends on
Gitweb::View? It is a strange dependency. I understand depending onGitweb::Gitto some extent, I'm not sure if we shouldn't simply move unescape to it instead of requiringGitweb::Escape(unless there is more:to_utf8perhaps?), and I understand thatGitweb::Utilhas some required subroutines.
for die_error.
Quoted 56 lines
Quoted 11 lines
Subroutines moved:
parse_date
parse_tag
parse_commit_text
parse_commit
parse_commits
parse_difftree_raw_line
parsed_difftree_line
parse_ls_tree_line
parse_from_to_diffinfoO.K.
Quoted 17 lines
Update 'gitweb/Makefile' to install
Gitweb::Parsealongside gitweb.Pavan Kumar Sunkara (11):
gitweb: fixesc_url
gitweb: Prepare for splitting gitweb
gitweb: CreateGitweb::Gitmodule
gitweb: CreateGitweb::Configmodule
gitweb: CreateGitweb::Requestmodule
gitweb: CreateGitweb::Escapemodule
gitweb: CreateGitweb::RepoConfigmodule
gitweb: CreateGitweb::Viewmodule
gitweb: CreateGitweb::Utilmodule
gitweb: CreateGitweb::Formatmodule
gitweb: CreateGitweb::ParsemoduleQuoted 2 lines
gitweb/Makefile | 14 +
gitweb/gitweb.perl | 3855 +++------------------------------------Nice!
Quoted 10 lines
gitweb/lib/Gitweb/Config.pm | 498 +++++ gitweb/lib/Gitweb/Escape.pm | 175 ++ gitweb/lib/Gitweb/Format.pm | 537 ++++++gitweb/lib/Gitweb/Git.pm | 48 + gitweb/lib/Gitweb/Parse.pm | 378 ++++ gitweb/lib/Gitweb/RepoConfig.pm | 424 +++++ gitweb/lib/Gitweb/Request.pm | 153 ++ gitweb/lib/Gitweb/Util.pm | 447 +++++ gitweb/lib/Gitweb/View.pm | 1022 +++++++++++
11 files changed, 3909 insertions(+), 3642 deletions(-)Quoted 9 lines
create mode 100644 gitweb/lib/Gitweb/Config.pm create mode 100644 gitweb/lib/Gitweb/Escape.pm create mode 100644 gitweb/lib/Gitweb/Format.pm create mode 100644 gitweb/lib/Gitweb/Git.pm create mode 100644 gitweb/lib/Gitweb/Parse.pm create mode 100644 gitweb/lib/Gitweb/RepoConfig.pm create mode 100644 gitweb/lib/Gitweb/Request.pm create mode 100644 gitweb/lib/Gitweb/Util.pm create mode 100644 gitweb/lib/Gitweb/View.pm
Quoted 6 lines
Keep up good work!
--
Jakub Narebski
Poland
So, If you can tell me what I need to change in this series, I would like to complete it and send a second version so that you can ack it and junio can merge it soon.
Thanks,
Pavan.
Quoted 4 lines · Pavan Kumar Sunkara
So, If you can tell me what I need to change in this series, I would like to complete it and send a second version so that you can ack it and junio can merge it soon.
I think this series is of quite good quality, perhaps with the sole exclusion of the problem with some modules not being clear of what they should contain, but I don't think the issue is show-stopper. Note that any O.K. after description of module means that I think that it is good as it is now.
More important than my ACK would be ACK from your mentors.
Also, you don't need to wait for the code to be merged. That's what (interactive) rebase and patch management interfaces like StGit, Guilt and TopGit are for ;-)
Quoted 14 lines
2010/6/22 Jakub Narebski <[email protected]>:
Quoted 13 lines · Pavan Kumar Sunkara
Quoted 11 lines
The modules created and being used by Gitweb are
Gitweb::Git
Gitweb::Config
Gitweb::Request
Gitweb::Escape
Gitweb::RepoConfig
Gitweb::View
Gitweb::Util
Gitweb::Format
Gitweb::Parse
Quoted 5 lines
Quoted 3 lines
What I would like to see here is a dependency graph, i.e. which modules include (use) which modules, and perhaps also how much this split reduces size of main gitweb.perl file.
The dependency is written in individual commits.
I have noticed, and thank you for that.
Nevertheless some upfront description of module dependencies, as a (partial) description of overall architecture, would be nice to have here. Something like:
Gitweb::Git
Gitweb::Config
Gitweb::Git ($git_dir)
Gitweb::Request
Gitweb::Escape
Gitweb::Config ($fallback_encoding)
Gitweb::RepoConfig
Gitweb::Git, Gitweb::Config, Gitweb::Escape, Gitweb::Request
Gitweb::View
Gitweb::Git, Gitweb::Config, Gitweb::Escape, Gitweb::Request
Gitweb::RepoConfig
Gitweb::Util
? Gitweb::Format
Gitweb::Config, Gitweb::Escape, Gitweb::Request, Gitweb::View (?)
Gitweb::Parse
Gitweb::Git, Gitweb::Escape, Gitweb::Util, Gitweb::View (die_error)
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
Shortlog:
=========3. gitweb: Create
Gitweb::GitmoduleCreate a
Gitweb::Gitmodule in 'gitweb/lib/Gitweb/Git.pm' to deal with running git commands (and also processing output of git commands with external programs) from gitweb.The "processing output of git commands with external programs" looks a bit strange to me. If it is about
quote_command()subroutine, it is more about shell escaping of commands, or about running other programs... but it might be O.K., if what you want to say thatquote_command()is used in pipe-ing output of git commands (e.g. git-archive) to other programs (e.g. gzip).
Quoted 4 lines
Quoted 1 line
So take the above comment with a bit of salt...
Actually that message has been written by you itself in one of the earlier threads.
Well, as you can see coming up with a good commit message is not easy. Nevertheless current message is, I guess, good enough.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
4. gitweb: Create
Gitweb::ConfigmoduleCreate
Gitweb::Configmodule in 'gitweb/lib/Gitweb/Config.pm' to store all the configuration variables and subroutines regarding the gitweb.perl script.This module depends only on $git_dir from
Gitweb::Gitand includes most of the configuration related variables and subroutines (Including those required for configuration of gitweb features).
Quoted 6 lines
Quoted 3 lines
"Most" meaning what? Which subroutines weren't moved, and why (they should not be in
Gitweb::Config, they cannot be moved for technical reasons)?Yes, due to either unment dependency or circular dependency problem. But no need to worry as they are very small.
Could you _*LIST*_ those subroutines that you feel should belong in Gitweb::Config but could not be put in it, and write _why_ they could not be put (on what subroutines / variables do they depend that it makes impossible to move them)?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Subroutines moved:
[...]
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
configure_gitweb_featuresI'm not sure if
configure_gitweb_features()should be there, as it is run-once subroutine, about flow of the main program... but perhaps it is O.K. to have it here.That's what I thought.
All right.
By the way, in the future we might think about making this module use object oriented interface, and/or tie-ing %features hash to it. But that is not something to worry about now.
Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
5. gitweb: Create
Gitweb::RequestmoduleCreate a
Gitweb::Requestmodule in 'gitweb/lib/Gitweb/Request.pm' to store and handle all the cgi params and related variables regarding the gitweb.perl script.This module is intended as standalone module, which does not require (include) other gitweb' modules to avoid circular dependencies.
validate_projectandvalidate_actioncan't be included in this module due to unmet dependencies.What unment dependencies? Can it be worked around by changing their signatures to use additional parameters, e.g.:
sub validate_action { my $input = shift || return undef; my $actions = shift || return undef;
Quoted 7 lines
Quoted 3 lines
return undef unless exists $actions->{$input}; return $input;}
Yes. I think we can but don't you think that we need to import %actions everytime we use
validate_action.
So, I figured it would be better If i leave it untouched for now.
Well, changing subroutines could be thought as being ot of scope of current series, which is about splitting gitweb and moving subroutines to appripriate modules... unless it would be not possible because of circular dependencies problem (but I guess it is not the case, ultimately).
Quoted 3 lines
Quoted 3 lines
But I guess it would be very hard to do the same with
validate_project. Also such change might be out of scope for _this_ series.
Perhaps it would be better then to move _all_ validate_* subroutines to separate Gitweb::Request::Validate module... unless they are used by some subroutine from Gitweb::Request.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refname
Quoted 6 lines
Quoted 3 lines
I'm not completly sure if validate_* subroutines should be not separate, as they do require more knowledge about setup, and about git repositories served, than the rest of
Gitweb::Requestsubroutines...But they are being used in
Gitweb::Requestsubroutines, so I included them in there.
Which Gitweb::Request subroutine uses validate_* subroutines? Neither evaluate_uri, nor evaluate_query_params, nor evaluate_path_info uses them. And evaluate_and_validate_params can be in Gitweb::Request::Validate.
If there is circular dependency in reasoning given above, please explain it.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
6. gitweb: Create
Gitweb::EscapemoduleCreate a
Gitweb::Escapemodule in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.This module imports $fallback_encoding variable from
Gitweb::Configmodule to use it in sub 'to_utf8'Subroutines moved:
[...]
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
unquote
Shouldn't unquote be in
Gitweb::Parse, as contrary to the rest of subroutines is is not about gitweb output escaping/quoting, but about processing (parsing) output of git commands? Perhaps it could even be provate toGitweb::Parse(i.e. not exported by default)...It would result in circular dependency. So, Escape module is best for it's place.
Errr... how? If unquote is used only by subroutines in Gitweb::Parse (and I think it is), it could be local to Gitweb::Parse, not even exported (by default). Please explain.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
7. gitweb: Create
Gitweb::RepoConfigmoduleCreate a
Gitweb::RepoConfigmodule in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It also include subroutines regarding
project_listand it's handling.Why? Is it to not have too many tiny modules, or is simply there no single good place where to put this subroutine?
There is no single good place. Anyhow, as they are regarding project configuration, I thought it would be better place for it.
O.K.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
8. gitweb: Create
Gitweb::ViewmoduleCreate
Gitweb::Viewmodule in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.
Quoted 8 lines
Quoted 8 lines
I find that this module looks a bit like a collection of fairly unrelated subroutines at very different levels of abstractions.
I guess that you don't want to split gitweb into too many modules, and splitting gitweb is more of one of steps to final goal of adding write functionality to gitweb, rather than the goal in and of itself. Nevertheless it would be good to be able to immediately know from the description of module what kind of subroutines should be there.
Any comment on this, if you don't mind? Even "I don't want to think more about better split" would be all right for me.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies.
Which subroutines and what unmet dependencies?
action specific HTML divs. They include format_* and parse_* subs.
Thanks for this info. It should be, IMHO, in the comit message.
But... Shouldn't all format_* subs be in Gitweb::Format anyway? Shouldn't all parse_* subs be in Gitweb::Parse anyway? Which of format_* and parse_* do you feel that belong here?
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
9. gitweb: Create
Gitweb::UtilmoduleCreate
Gitweb::Utilmodule in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash
[...]
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
is_patch_splitO.K.
Quoted 1 line
run_highlighter_Perhaps_ with exception of this subroutine.
Well. It was in the utility category in gitweb.perl script. So, I added it in here without giving much thought.
Well, it is good explanation. All right, then.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
10. gitweb: Create
Gitweb::FormatmoduleCreate
Gitweb::Formatmodule in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Quoted 5 lines
Quoted 3 lines
Why it depends on
Gitweb::View, and not the reverse? I understand why it depends onGitweb::ConfigandGitweb::Escape, and I guess it needs $cgi fromGitweb::Request(or is it something more?).$hash, $hash_parent also.
Why it depends on Gitweb::View? Is it because of ubiquitous and troublesome :-) die_error?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
11. gitweb: Create
Gitweb::ParsemoduleCreate
Gitweb::Parsemodule in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Quoted 7 lines
Quoted 5 lines
Why it depends on
Gitweb::View? It is a strange dependency. I understand depending onGitweb::Gitto some extent, I'm not sure if we shouldn't simply move unescape to it instead of requiringGitweb::Escape(unless there is more:to_utf8perhaps?), and I understand thatGitweb::Utilhas some required subroutines.for
die_error.
Ah, I se that any run of git command is protected with 'or die_error(...)'. Hmmm, not very good.
Well, in the future we could think about decoupling Gitweb::Parse from other modules, but for now it should be enough to mention in commit message that Gitweb::Parse depends on Gitweb::View because of die_error. Good for now. O.K.
Perhaps die_error should be in Gitweb::Carp? But it neds git_header_html etc. anyway. Ugh.
Signature · 2 lines
Jakub Narebski Poland
Quoted 9 lines · Jakub Narebski
Quoted 3 lines · Pavan Kumar Sunkara
Yes, due to either unment dependency or circular dependency problem. But no need to worry as they are very small.
Could you _*LIST*_ those subroutines that you feel should belong in
Gitweb::Configbut could not be put in it, and write _why_ they could not be put (on what subroutines / variables do they depend that it makes impossible to move them)?
feature_* subs. They can't be put in it because they use git_get_project_config from Gitweb::RepoConfig module
Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
What unment dependencies? Can it be worked around by changing their signatures to use additional parameters, e.g.:
sub
validate_action{
my $input = shift || return undef;
my $actions = shift || return undef;Quoted 7 lines
Quoted 3 lines
return undef unless exists $actions->{$input}; return $input;
}Yes. I think we can but don't you think that we need to import %actions everytime we use
validate_action.
So, I figured it would be better If i leave it untouched for now.Well, changing subroutines could be thought as being ot of scope of current series, which is about splitting gitweb and moving subroutines to appripriate modules... unless it would be not possible because of circular dependencies problem (but I guess it is not the case, ultimately).
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
But I guess it would be very hard to do the same with
validate_project. Also such change might be out of scope for _this_ series.Perhaps it would be better then to move _all_ validate_* subroutines to separate
Gitweb::Request::Validatemodule... unless they are used by some subroutine fromGitweb::Request.
or even better if we leave them untouched for now. (in gitweb.perl script) and move them later along with the evaluate_validate_params function
Quoted 40 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Subroutines moved:
evaluate_uri
evaluate_query_params
validate_pathname
validate_refnameQuoted 6 lines
Quoted 3 lines
I'm not completly sure if validate_* subroutines should be not separate, as they do require more knowledge about setup, and about git repositories served, than the rest of
Gitweb::Requestsubroutines...But they are being used in
Gitweb::Requestsubroutines, so I included them in there.Which
Gitweb::Requestsubroutine uses validate_* subroutines? Neitherevaluate_uri, norevaluate_query_params, norevaluate_path_infouses them. Andevaluate_and_validate_paramscan be inGitweb::Request::Validate.If there is circular dependency in reasoning given above, please explain it.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
6. gitweb: Create
Gitweb::EscapemoduleCreate a
Gitweb::Escapemodule in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.This module imports $fallback_encoding variable from
Gitweb::Configmodule to use it in sub 'to_utf8'Subroutines moved:
[...]
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
unquote
Shouldn't unquote be in
Gitweb::Parse, as contrary to the rest of subroutines is is not about gitweb output escaping/quoting, but about processing (parsing) output of git commands? Perhaps it could even be provate toGitweb::Parse(i.e. not exported by default)...
Quoted 6 lines
Quoted 2 lines
It would result in circular dependency. So, Escape module is best for it's place.
Errr... how? If unquote is used only by subroutines in
Gitweb::Parse(and I think it is), it could be local toGitweb::Parse, not even exported (by default). Please explain.
Oh! I didn't know that.
I will change it.
Quoted 29 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
7. gitweb: Create
Gitweb::RepoConfigmoduleCreate a
Gitweb::RepoConfigmodule in 'gitweb/lib/Gitweb/RepoConfig.pm' to store and handle all the configuration and subroutines related to a single repository regarding the gitweb.perl script.This module depend on several other modules like Git.pm, Config.pm, Request.pm and Escape.pm.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It also include subroutines regarding
project_listand it's handling.Why? Is it to not have too many tiny modules, or is simply there no single good place where to put this subroutine?
There is no single good place. Anyhow, as they are regarding project configuration, I thought it would be better place for it.
O.K.
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
8. gitweb: Create
Gitweb::ViewmoduleCreate
Gitweb::Viewmodule in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.I find that this module looks a bit like a collection of fairly unrelated subroutines at very different levels of abstractions.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
I guess that you don't want to split gitweb into too many modules, and splitting gitweb is more of one of steps to final goal of adding write functionality to gitweb, rather than the goal in and of itself. Nevertheless it would be good to be able to immediately know from the description of module what kind of subroutines should be there.
Any comment on this, if you don't mind? Even "I don't want to think more about better split" would be all right for me.
I don't want to think more about better split :)
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies.
Which subroutines and what unmet dependencies?
Quoted 7 lines
Quoted 1 line
action specific HTML divs. They include format_* and parse_* subs.
Thanks for this info. It should be, IMHO, in the comit message.
But... Shouldn't all format_* subs be in
Gitweb::Formatanyway? Shouldn't all parse_* subs be inGitweb::Parseanyway? Which of format_* and parse_* do you feel that belong here?
Yes. I think u misunderstood me.Gitweb::parse and Gitweb::Formst depend on Gitweb::View. So, action specific HTML divs can't be placed in Gitweb::View because they depend on Gitweb::Format and Gitweb::parse.
I think it's better if they are in GitwebAction::* modules
Quoted 70 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
9. gitweb: Create
Gitweb::UtilmoduleCreate
Gitweb::Utilmodule in 'gitweb/lib/Gitweb/Util.pm' to store the git utility subroutines related to gitweb.This module include subroutines in various categories such as git utility subs invoking git commands, git utility subs accessing git repository, mimetype related subs and HTML output utility subs.
Subroutines moved:
git_get_head_hash[...]
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
is_patch_splitO.K.
Quoted 1 line
run_highlighter_Perhaps_ with exception of this subroutine.
Well. It was in the utility category in gitweb.perl script. So, I added it in here without giving much thought.
Well, it is good explanation. All right, then.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
10. gitweb: Create
Gitweb::FormatmoduleCreate
Gitweb::Formatmodule in 'gitweb/lib/Gitweb/Format.pm' to store the subroutines related to formatting of HTML fragments required for gitweb.This module depends on Config.pm, View.pm, Escape.pm, Util.pm and Request.pm. It mainly contain functions returning short HTML fragments or transforming HTML fragments. Also include subroutines regarding avatar formatting.
Quoted 5 lines
Quoted 3 lines
Why it depends on
Gitweb::View, and not the reverse? I understand why it depends onGitweb::ConfigandGitweb::Escape, and I guess it needs $cgi fromGitweb::Request(or is it something more?).$hash, $hash_parent also.
Why it depends on
Gitweb::View? Is it because of ubiquitous and troublesome :-)die_error?Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
11. gitweb: Create
Gitweb::ParsemoduleCreate
Gitweb::Parsemodule in 'gitweb/lib/Gitweb/Parse.pm' to store the subroutines which related to parsing functions required for gitweb.This module depends on Git.pm, Escape.pm, View.pm and Util.pm.
Quoted 7 lines
Quoted 5 lines
Why it depends on
Gitweb::View? It is a strange dependency. I understand depending onGitweb::Gitto some extent, I'm not sure if we shouldn't simply move unescape to it instead of requiringGitweb::Escape(unless there is more:to_utf8perhaps?), and I understand thatGitweb::Utilhas some required subroutines.for
die_error.Ah, I se that any run of git command is protected with 'or
die_error(...)'. Hmmm, not very good.Well, in the future we could think about decoupling
Gitweb::Parsefrom other modules, but for now it should be enough to mention in commit message thatGitweb::Parsedepends onGitweb::Viewbecause ofdie_error. Good for now. O.K.
Quoted 7 lines
Perhaps
die_errorshould be inGitweb::Carp? But it nedsgit_header_htmletc. anyway. Ugh.--
Jakub Narebski
Poland
Thanks,
Pavan.
Quoted 6 lines · Pavan Kumar Sunkara
Quoted 5 lines · Jakub Narebski
Quoted 3 lines · Pavan Kumar Sunkara
Yes, due to either unment dependency or circular dependency problem. But no need to worry as they are very small.
Quoted 7 lines
Quoted 4 lines
Could you _*LIST*_ those subroutines that you feel should belong in
Gitweb::Configbut could not be put in it, and write _why_ they could not be put (on what subroutines / variables do they depend that it makes impossible to move them)?feature_* subs. They can't be put in it because they use
git_get_project_configfromGitweb::RepoConfigmodule
O.K., but that information should IMHO be in the commit message. But shouldn't feature_* subs (except perhaps utility feature_bool etc.) be in Gitweb::RepoConfig rather than Gitweb::Config anyway?
[...]
Quoted 6 lines
Quoted 3 lines
Perhaps it would be better then to move _all_ validate_* subroutines to separate
Gitweb::Request::Validatemodule... unless they are used by some subroutine fromGitweb::Request.or even better if we leave them untouched for now. (in gitweb.perl script) and move them later along with the
evaluate_validate_paramsfunction
That's good enough for me.
Quoted 22 lines
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
6. gitweb: Create
Gitweb::EscapemoduleCreate a
Gitweb::Escapemodule in 'gitweb/lib/Gitweb/Escape.pm' to store all the quoting/unquoting and escaping subroutines regarding the gitweb.perl script.This module imports $fallback_encoding variable from
Gitweb::Configmodule to use it in sub 'to_utf8'Subroutines moved:
[...]
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
unquote
Shouldn't unquote be in
Gitweb::Parse, as contrary to the rest of subroutines is is not about gitweb output escaping/quoting, but about processing (parsing) output of git commands? Perhaps it could even be provate toGitweb::Parse(i.e. not exported by default)...It would result in circular dependency. So, Escape module is best for it's place.
Quoted 6 lines
Quoted 3 lines
Errr... how? If unquote is used only by subroutines in
Gitweb::Parse(and I think it is), it could be local toGitweb::Parse, not even exported (by default). Please explain.Oh! I didn't know that.
I will change it.
O.K.
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
8. gitweb: Create
Gitweb::ViewmoduleCreate
Gitweb::Viewmodule in 'gitweb/lib/Gitweb/View.pm' to store the subroutines related to the HTML output for gitweb.I find that this module looks a bit like a collection of fairly unrelated subroutines at very different levels of abstractions.
I guess that you don't want to split gitweb into too many modules, and splitting gitweb is more of one of steps to final goal of adding write functionality to gitweb, rather than the goal in and of itself. Nevertheless it would be good to be able to immediately know from the description of module what kind of subroutines should be there.
Quoted 4 lines
Quoted 2 lines
Any comment on this, if you don't mind? Even "I don't want to think more about better split" would be all right for me.
I don't want to think more about better split :)
NOTE that the goal of splitting gitweb was to make it possible to put write functionalities for gitweb in separate module(s). Would it be possible with this proposed split? If it is, then further enhancements and refactoring to how gitweb is split into modules could be done "in tree", after this GSoC 2010 project is completed.
BTW. what write feature would be easiest to write? Authentication (only localhost / 127.0.0.1)? Creating lightweight tags? Scanning for repositories and saving them in project index file?
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This module depends on Git.pm, Config.pm, Request.pm, Escape.pm and RepoConfig.pm. Some subroutines which output HTML but are not included in this module due to unmet dependencies.
Which subroutines and what unmet dependencies?
action specific HTML divs. They include format_* and parse_* subs.
Quoted 7 lines
Quoted 5 lines
Thanks for this info. It should be, IMHO, in the comit message.
But... Shouldn't all format_* subs be in
Gitweb::Formatanyway? Shouldn't all parse_* subs be inGitweb::Parseanyway? Which of format_* and parse_* do you feel that belong here?Yes. I think you misunderstood me.
Ah, format_* and parse_* were "unment dependencies", not "not included subroutines".
So what were those "not includes subroutines"?
Quoted 6 lines
Gitweb::ParseandGitweb::Formstdepend onGitweb::View. So, action specific HTML divs can't be placed inGitweb::Viewbecause they depend onGitweb::FormatandGitweb::Parse.I think it's better if they are in GitwebAction::* modules
All right.
P.S. Unentangling interdependencies between gitweb subroutines can be left for later, but it looks like it would have to be necessary later.
Signature · 2 lines
Jakub Narebski Poland