summaryrefslogtreecommitdiff
path: root/gitweb
AgeCommit message (Collapse)AuthorFilesLines
2008-12-16gitweb: do not run "git diff" that is PorcelainLibravatar Junio C Hamano1-37/+3
Jakub says that legacy-style URI to view two blob differences are never generated since 1.4.3. This codepath runs "git diff" Porcelain from the gitweb, which is a no-no. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-08gitweb: Fix bug in insert_file() subroutineLibravatar Jakub Narebski1-1/+1
In insert_file() subroutine (which is used to insert HTML fragments as custom header, footer, hometext (for projects list view), and per project README.html (for summary view)) we used: map(to_utf8, <$fd>); This doesn't work, and other form has to be used: map { to_utf8($_) } <$fd>; Now with test for t9600 added, for $GIT_DIR/README.html. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-07Merge branch 'maint'Libravatar Junio C Hamano1-0/+1
* maint: GIT 1.6.0.5 "git diff <tree>{3,}": do not reverse order of arguments tag: delete TAG_EDITMSG only on successful tag gitweb: Make project specific override for 'grep' feature work http.c: use 'git_config_string' to get 'curl_http_proxy' fetch-pack: Avoid memcpy() with src==dst
2008-12-07gitweb: Make project specific override for 'grep' feature workLibravatar Jakub Narebski1-0/+1
The 'grep' feature was marked in the comments as having project specific config, but it lacked 'sub' key required for it to work. Kind-of-Noticed-by: Matt Kraai <kraai@ftbfs.org> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-03Merge branch 'jn/gitweb-utf8'Libravatar Junio C Hamano1-16/+16
* jn/gitweb-utf8: gitweb: Fix handling of non-ASCII characters in inserted HTML files
2008-12-02gitweb: Fix handling of non-ASCII characters in inserted HTML filesLibravatar Jakub Narebski1-16/+16
Use new insert_file() subroutine to insert HTML chunks from external files: $site_header, $home_text (by default indextext.html), $site_footer, and $projectroot/$project/REAME.html. All non-ASCII chars of those files will be broken by Perl IO layer without decoding to utf8, so insert_file() does to_utf8() on each printed line; alternate solution would be to open those files with "binmode $fh, ':utf8'", or even all files with "use open qw(:std :utf8)". Note that inserting README.html lost one of checks for simplicity. Noticed-by: Tatsuki Sugiura <sugi@nemui.org> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-02Update comment on gitweb_check/get_featureLibravatar Giuseppe Bilotta1-1/+3
This is taken from a patch from Giuseppe but unfortunately it came too late to replace the series that was already on "next". The comment he updated here is better than the version we had previously, so I am cherry-picking this bit not to lose it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-30gitweb: make gitweb_check_feature a boolean wrapperLibravatar Giuseppe Bilotta1-20/+36
The gitweb_get_feature() function retrieves the configuration parameters for the feature (such as the list of snapshot formats or the list of additional actions), but it is very often used to see if feature is enabled (which is returned as the first element in the list). Because accepting the returned list in the scalar context by mistake yields the number of elements in the array, which is non-zero in all cases, such a mistake would result in a bug for the latter use, with disabled features appearing enabled. All existing callers that call the function for this purpose assign the return value in the list context to retrieve the first element, but that is only because we fixed careless callers recently. This adds gitweb_check_feature() as a wrapper to gitweb_get_feature() that can be called safely in the scalar context to see if a feature is enabled to reduce the risk of future bugs. Callers of "get" that use the call only to see if the feature is enabled are updated to call this wrapper. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-30gitweb: rename gitweb_check_feature to gitweb_get_featureLibravatar Junio C Hamano1-23/+23
The function is about retrieving the configuration parameter list for the feature. A more robust way to check if a feature is enabled will be introduced in the next patch, and the function will be called gitweb_check_feature. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-30gitweb: fix 'ctags' feature check and othersLibravatar Junio C Hamano1-7/+7
gitweb_check_feature() function is to retrieve the configuration parameter list and calling it in the scalar context does not give its first element that tells if the feature is enabled. This fixes all the existing callers to call the function correctly in the list context. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-12Merge branch 'jn/gitweb-customlinks'Libravatar Junio C Hamano1-7/+12
* jn/gitweb-customlinks: gitweb: Better processing format string in custom links in navbar
2008-11-12Merge branch 'gb/gitweb-snapshot-pathinfo'Libravatar Junio C Hamano1-8/+63
* gb/gitweb-snapshot-pathinfo: gitweb: embed snapshot format parameter in PATH_INFO gitweb: retrieve snapshot format from PATH_INFO gitweb: make the supported snapshot formats array global
2008-11-06gitweb: Fix mod_perl support.Libravatar Alexander Gavrilov1-6/+6
ModPerl::Registry precompiles scripts by wrapping them in a subroutine. This causes ordinary subroutines of the script to become nested, and warnings appear: gitweb.cgi: Variable "$path_info" will not stay shared This warning means that $path_info was declared as 'my', and thus according to the perl evaluation rules all nested subroutines will retain a reference to the instance of the variable used in the first invocation of the master script. When the script (i.e. the master meta-subroutine) is executed the second time, it will use a new instance, so the logic breaks. To avoid this it is necessary to declare all global variables as 'our', which places them at the package level. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-06gitweb: Add a per-repository authorization hook.Libravatar Alexander Gavrilov2-1/+28
Add a configuration variable that can be used to specify an arbitrary subroutine that will be called in the same situations where $export_ok is checked, and its return value used to decide whether the repository is to be shown. This allows the user to implement custom authentication schemes, for example by issuing a subrequest through mod_perl and checking if Apache will authorize it. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-06gitweb: Use single implementation of export_ok check.Libravatar Alexander Gavrilov1-2/+1
GitWeb source contains a special function that implements the export_ok check, but validate_project still uses a separate copy of essentially the same code. This patch makes it use the dedicated function, thus ensuring that all checks are done through a single code path. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-05Merge branch 'jc/gitweb-fix-cloud-tag'Libravatar Junio C Hamano1-1/+5
* jc/gitweb-fix-cloud-tag: Fix reading of cloud tags
2008-11-02gitweb: embed snapshot format parameter in PATH_INFOLibravatar Giuseppe Bilotta1-0/+17
When PATH_INFO is active, get rid of the sf CGI parameter by embedding the snapshot format information in the PATH_INFO URL, in the form of an appropriate extension. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-02gitweb: retrieve snapshot format from PATH_INFOLibravatar Giuseppe Bilotta1-0/+39
We parse requests for $project/snapshot/$head.$sfx as equivalent to $project/snapshot/$head?sf=$sfx, where $sfx is any of the known (although not necessarily supported) snapshot formats (or its default suffix). The filename for the resulting package preserves the requested extensions (so asking for a .tgz gives a .tgz, and asking for a .tar.gz gives a .tar.gz), although for obvious reasons it doesn't preserve the basename (git/snapshot/next.tgz returns a file names git-next.tgz). This introduces a potential case for ambiguity if a project has a head that ends with a snapshot-like suffix (.zip, .tgz, .tar.gz, etc) and the sf CGI parameter is not present; however, gitweb only produces URLs with the sf parameter currently, so this is only a potential issue for hand-coded URLs for extremely unusual project. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-02gitweb: make the supported snapshot formats array globalLibravatar Giuseppe Bilotta1-8/+7
The array of supported snapshot format is used and defined (with two different names) in two routines, one of which (format_snapshot_links) is often called multiple times per page. Simplify code and speed up page generation by making the array global. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-25gitweb: generate parent..current URLsLibravatar Giuseppe Bilotta1-4/+24
If use_pathinfo is enabled, href now creates links that contain paths in the form $project/$action/oldhash:/oldname..newhash:/newname for actions that use hash_parent etc. If any of the filename contains two consecutive dots, it's kept as a CGI parameter since the resulting path would otherwise be ambiguous. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-25gitweb: parse parent..current syntax from PATH_INFOLibravatar Giuseppe Bilotta1-2/+34
This patch makes it possible to use an URL such as project/action/somebranch..otherbranch:/filename to get a diff between different version of a file. Paths like project/action/somebranch:/somefile..otherbranch:/otherfile are parsed as well. All '*diff' actions and in general actions that use $hash_parent[_base] and $file_parent (e.g. 'shortlog') can now get all of their parameters from PATH_INFO Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-25gitweb: use_pathinfo filenames start with /Libravatar Giuseppe Bilotta1-3/+3
Generate PATH_INFO URLs in the form project/action/hash_base:/filename rather than project/action/hash_base:filename (the latter form is still accepted in input). This minimal change allows relative navigation to work properly when viewing HTML files in raw ('blob_plain') mode. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-25gitweb: generate project/action/hash URLsLibravatar Giuseppe Bilotta1-3/+30
When generating path info URLs, reduce the number of CGI parameters by embedding action and hash_parent:filename or hash in the path. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-25gitweb: parse project/action/hash_base:filename PATH_INFOLibravatar Giuseppe Bilotta1-7/+39
This patch enables gitweb to parse URLs with more information embedded in PATH_INFO, reducing the need for CGI parameters. The typical gitweb path is now $project/$action/$hash_base:$file_name or $project/$action/$hash This is mostly backwards compatible with the old-style gitweb paths, $project/$branch[:$filename], except when it was used to access a branch whose name matches a gitweb action. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14Fix reading of cloud tagsLibravatar Junio C Hamano1-1/+5
The projectroot path could have SP in it, in which case iterating over <$git_dir/ctags/*> does not correctly enumerate the cloud tags files at all. This can be observed by creating an empty t/trash directory and running t9500 test. The $projectroot ends with "trash directory.t9500-gitweb-/" and <$glob> would give "trash", which can be opened and reading from it immediately yields undef, which in turn gives an undef value warning to the standard error stream upon attempt to chomp it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-12gitweb: refactor input parameters parse/validationLibravatar Giuseppe Bilotta1-137/+178
Since input parameters can be obtained both from CGI parameters and PATH_INFO, we would like most of the code to be agnostic about the way parameters were retrieved. We thus collect all the parameters into the new %input_params hash, delaying validation after the collection is completed. Although the kludge removal is minimal at the moment, it makes life much easier for future expansions such as more extensive PATH_INFO use or other form of input such as command-line support. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12gitweb: Better processing format string in custom links in navbarLibravatar Jakub Narebski1-7/+12
Make processing format string in custom links in action bar ('actions' feature) more robust. Now there would be no problems if one of expanded values (for example project name, of project filename) contains '%'; additionally format string supports '%' escaping by doubling, i.e. '%%' expands to '%'. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-03Merge branch 'pb/gitweb-tagcloud' into pb/gitwebLibravatar Shawn O. Pearce2-9/+145
* pb/gitweb-tagcloud: gitweb: Support for simple project search form gitweb: Make the by_tag filter delve in forks as well gitweb: Support for tag clouds ... (+ many updates from master) ... Conflicts: gitweb/gitweb.perl
2008-10-03gitweb: Support for simple project search formLibravatar Petr Baudis2-2/+14
This is a trivial patch adding support for searching projects by name and description, making use of the "infrastructure" provided by the tag cloud generation. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-03gitweb: Make the by_tag filter delve in forks as wellLibravatar Petr Baudis1-3/+10
This requires us to build a full index including forks and then weed them out only when printing. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-03gitweb: Support for tag cloudsLibravatar Petr Baudis1-0/+109
The "Content tags" (nothing to do with usual Git tags!) are free-form strings that are attached to random projects and displayed in the well-known Web2.0-ish tag cloud above project list. The feature will make use of HTML::TagCloud if available, but will still display (less pretty) list of tags in case the module is not installed. The tagging itself is not done by gitweb - user-provided external helper CGI needs to be provided; one example is the tagproj.cgi of Girocco. This functionality might get integrated to gitweb in the future. The tags are stored one-per-file in ctags/ subdirectory. The reason they are not stored in the project config file is that you usually want to give anyone (even CGI scripts) permission to create new tags and they are non-essential information, and thus you would make the ctags/ subdirectory world-writable. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-02gitweb: Add support for extending the action bar with custom linksLibravatar Petr Baudis1-1/+34
This makes it possible to easily extend gitweb with custom functionality, e.g. git-browser or web-based repository administration system like the repo.or.cz/Girocco duct tape. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-02Merge branch 'maint'Libravatar Shawn O. Pearce1-1/+9
* maint: gitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh gitweb: Fix two 'uninitialized value' warnings in git_tree() Solaris: Use OLD_ICONV to avoid compile warnings gitweb: remove PATH_INFO from $my_url and $my_uri
2008-10-02gitweb: Fix two 'uninitialized value' warnings in git_tree()Libravatar Jakub Narebski1-1/+2
If we did try to access nonexistent directory or file, which means that git_get_hash_by_path() returns `undef`, uninitialized $hash variable was passed to 'open' call. Now we fail early with "404 Not Found - No such tree" error. (If we try to access something which does not resolve to tree-ish, for example a file / 'blob' object, the error will be caught later, as "404 Not Found - Reading tree failed" error). If we tried to use 'tree' action without $file_name ('f' parameter) set, which means either tree given by hash or a top tree (and we currently cannot distinguish between those two cases), we cannot print path breadcrumbs with git_print_page_path(). Fix this by moving call to git_print_page_path() inside conditional. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-02gitweb: Identify all summary metadata table rowsLibravatar Petr Baudis1-4/+4
In the metadata table of the summary page, all rows have their id (or class in case of URL) set now. This for example lets sites easily disable fields they do not want to show in their custom stylesheet (e.g. they are overly technical or irrelevant for the site). Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-02gitweb: remove PATH_INFO from $my_url and $my_uriLibravatar Giuseppe Bilotta1-0/+7
This patch fixes PATH_INFO handling by removing the relevant part from $my_url and $my_uri, thus making it unnecessary to specify them by hand in the gitweb configuration. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-02gitweb: Quote non-displayable characters in hex, not octalLibravatar Petr Baudis1-1/+1
For the last 30 years, the mankind uses the octal representation of characters only in rare cases and most character codes are hardly recognizable in octal. In contrast, many programmers still know hexadecimal well and that is also the representation of choice e.g. for Unicode codepoints. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-01gitweb: Sort the list of forks on the summary page by ageLibravatar Mike Ralphson1-2/+2
The list of forks on the summary page was unsorted, this just makes them sorted by age, which seems a fair way to decide which forks are shown before the list size cut-off (15) kicks in. s/noheader/no_header was just to make it obvious what the parameter affects, so all the code can be found with one grep. pb: As suggested by Mike, I have augmented this by an additional patch that refactors the sorting logic so that it is not tied to printing the headers. Signed-off-by: Mike Ralphson <mike@abacus.co.uk> Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-01gitweb: Clean-up sorting of project listLibravatar Petr Baudis1-25/+20
This decouples the sorting of project list and printing the column headers, so that the project list can be easily sorted even when the headers are not shown. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-25gitweb: shortlog now also obeys $hash_parentLibravatar Giuseppe Bilotta1-1/+5
If $hash_parent is defined, shortlog now limits the list of commits at those between $hash_parent (exclusive) and $hash (inclusive). Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-18Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: sha1_file: link() returns -1 on failure, not errno Make git archive respect core.autocrlf when creating zip format archives Add new test to demonstrate git archive core.autocrlf inconsistency gitweb: avoid warnings for commits without body Clarified gitattributes documentation regarding custom hunk header. git-svn: fix handling of even funkier branch names git-svn: Always create a new RA when calling do_switch for svn:// git-svn: factor out svnserve test code for later use diff/diff-files: do not use --cc too aggressively
2008-09-18gitweb: avoid warnings for commits without bodyLibravatar Joey Hess1-1/+1
In the unusual case when there is no commit message, gitweb would output an uninitialized value warning. Signed-off-by: Joey Hess <joey@kitenet.net> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-02gitweb: ref markers link to named shortlogsLibravatar Giuseppe Bilotta2-3/+47
This patch turns ref markers for tags and heads into links to appropriate views for the ref name, depending on current context. For annotated tags, we link to the tag view, unless that's the current view, in which case we switch to shortlog. For other refs, we prefer the current view if it's history or (short)log, and default to shortlog otherwise. Appropriate changes are made in the CSS to prevent ref markers from being annoyingly blue and underlined, unless hovered. A visual indication of the target view difference is also implemented by making annotated tags show up in italic. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27gitweb: More about how gitweb gets 'owner' of repositoryLibravatar Jakub Narebski1-1/+2
Signed-off-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07gitweb: Describe projects_index format in more detailLibravatar Jakub Narebski2-6/+46
Update and extend information about $projects_list file format in gitweb/README and in gitweb/INSTALL. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-25Merge branch 'lw/gitweb'Libravatar Junio C Hamano1-106/+105
* lw/gitweb: gitweb: standarize HTTP status codes
2008-06-22Merge branch 'jn/web'Libravatar Junio C Hamano1-49/+62
* jn/web: gitweb: Separate generating 'sort by' table header gitweb: Separate filling list of projects info
2008-06-22Merge branch 'rg/gitweb'Libravatar Junio C Hamano1-99/+2
* rg/gitweb: gitweb: remove git_blame and rename git_blame2 to git_blame
2008-06-19gitweb: standarize HTTP status codesLibravatar Lea Wiemann1-106/+105
Many error status codes simply default to 403 Forbidden, which is not correct in most cases. This patch makes gitweb return semantically correct status codes. For convenience the die_error function now only takes the status code without reason as first parameter (e.g. 404 instead of "404 Not Found"), and it now defaults to 500 (Internal Server Error), even though the default is not used anywhere. Also documented status code conventions in die_error. Signed-off-by: Lea Wiemann <LeWiemann@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-17gitweb: remove unused parse_ref methodLibravatar Lea Wiemann1-43/+0
The parse_ref method became unused in cd1464083c, but the author decided to leave it in. Now it gets in the way of refactoring, so let's remove it. Signed-off-by: Lea Wiemann <LeWiemann@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>