path: root/gitweb/gitweb.perl
AgeCommit message (Collapse)Author
2009-12-01Merge branch 'jn/gitweb-blame'Junio C Hamano
* jn/gitweb-blame: gitweb: Add link to other blame implementation in blame views gitweb: Make linking to actions requiring JavaScript a feature gitweb.js: fix padLeftStr() and its usage gitweb.js: Harden setting blamed commit info in incremental blame gitweb.js: fix null object exception in initials calculation gitweb: Minify gitweb.js if JSMIN is defined gitweb: Create links leading to 'blame_incremental' using JavaScript gitweb: Colorize 'blame_incremental' view during processing gitweb: Incremental blame (using JavaScript) gitweb: Add optional "time to generate page" info in footer Conflicts: Makefile gitweb/gitweb.css
2009-12-01gitweb: Add link to other blame implementation in blame viewsJakub Narebski
Add link to 'blame_incremental' action (which requires JavaScript) in 'blame' view, and add link to 'blame' action in 'blame_incremental' view. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-12-01gitweb: Make linking to actions requiring JavaScript a featureJakub Narebski
Let gitweb turn some links (like 'blame' links) into linking to actions which require JavaScript (like 'blame_incremental' action) only if 'javascript-actions' feature is enabled. This means that links to such actions would be present only if both JavaScript is enabled and 'javascript-actions' feature is enabled. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-11-24Merge branch 'mr/gitweb-snapshot'Junio C Hamano
* mr/gitweb-snapshot: t/gitweb-lib: Split HTTP response with non-GNU sed gitweb: Smarter snapshot names gitweb: Document current snapshot rules via new tests t/ Split gitweb output into headers and body gitweb: check given hash before trying to create snapshot
2009-11-14gitweb: Make 'history' view (re)use git_log_generic()Jakub Narebski
Make git_history use git_log_generic, passing git_history_body as one of its paramaters. This required changes to git_log_generic, in particular passing more things as parameters. While refactoring common code of 'log', 'shortlog' and 'history' view, we did unify pagination, using always the form used by 'history' view, namely first * prev * next in place of HEAD * prev * next used by 'log' and 'shortlog' views. The 'history' view now supports commit limiting via 'hpb' parameter, similarly to 'shortlog' (and 'log') view. Performance of 'history' view got improved a bit, as it doesn't run git_get_hash_by_path for "current" version in a loop. Error detection and reporting for 'history' view changed a bit. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-11-14gitweb: Refactor common parts of 'log' and 'shortlog' viewsJakub Narebski
Put the common parts of git_log and git_shortlog into git_log_generic subroutine: git_log and git_shortlog are now thin wrappers calling git_log_generic with appropriate arguments. The unification of code responsible for 'log' and 'shorlog' actions lead to the following changes in gitweb output * 'tree' link in page_nav now uses $hash parameter, as was the case for 'shortlog' but not for 'log' * 'log' view now respect $hash_parent limiting, like 'shortlog' did * 'log' view doesn't have special case for empty list anymore, and it always uses page_header linking to summary view, like 'shortlog' did. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-11-14gitweb: Refactor 'log' action generation, adding git_log_body()Jakub Narebski
Put the main part of 'log' view generation into git_log_body, similarly how it is done for 'shortlog' and 'history' views (and also for 'tags' and 'heads' views). This is preparation for extracting common code between 'log', 'shortlog' and 'history' actions. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-11-10Merge branch 'pb/maint-gitweb-blob-lineno'Junio C Hamano
* pb/maint-gitweb-blob-lineno: gitweb: Fix blob linenr links in pathinfo mode
2009-11-09gitweb: Smarter snapshot namesMark Rada
Teach gitweb how to produce nicer snapshot names by only using the short hash id. If clients make requests using a tree-ish that is not a partial or full SHA-1 hash, then the short hash will also be appended to whatever they asked for. If clients request snapshot of a tag (which means that $hash ('h') parameter has 'refs/tags/' prefix), use only tag name. Update tests cases in t9502-gitweb-standalone-parse-output. Gitweb uses the following format for snapshot filenames: <sanitized project name>-<version info>.<snapshot suffix> where <sanitized project name> is project name with '.git' or '/.git' suffix stripped, unless '.git' is the whole project name. For snapshot prefix it uses: <sanitized project name>-<version info>/ as compared to <sanitized project name>/ before (without version info). Current rules for <version info>: * if 'h' / $hash parameter is SHA-1 or shortened SHA-1, use SHA-1 shortened to to 7 characters * otherwise if 'h' / $hash parameter is tag name (it begins with 'refs/tags/' prefix, use tag name (with 'refs/tags/' stripped * otherwise if 'h' / $hash parameter starts with 'refs/heads/' prefix, strip this prefix, convert '/' into '.', and append shortened SHA-1 after '-', i.e. use <sanitized hash>-<shortened sha1> Signed-off-by: Mark Rada <> Signed-off-by: Shawn O. Pearce <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-11-06gitweb: Fix blob linenr links in pathinfo modePetr Baudis
In pathinfo mode, we use <base href> that refers to the base location of gitweb in order for various external media links to work well. However, this means that for the page to refer to itself, it must regenerate full link, and this is exactly what the blob view page did not do for line numbers. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2009-10-26Merge branch 'sb/gitweb-link-author'Junio C Hamano
* sb/gitweb-link-author: gitweb: linkify author/committer names with search
2009-10-22Merge branch 'gb/maint-gitweb-esc-param'Junio C Hamano
* gb/maint-gitweb-esc-param: gitweb: fix esc_param
2009-10-20gitweb: linkify author/committer names with searchStephen Boyd
It's nice to search for an author by merely clicking on their name in gitweb. This is usually faster than selecting the name, copying the selection, pasting it into the search box, selecting between author/committer and then hitting enter. Linkify the avatar icon in log/shortlog view because the icon is directly adjacent to the name and thus more related. The same is not true when in commit/tag view where the icon is farther away. Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
2009-10-19Merge branch 'jn/gitweb-show-size'Junio C Hamano
* jn/gitweb-show-size: gitweb: Add 'show-sizes' feature to show blob sizes in tree view
2009-10-14gitweb: fix esc_paramGiuseppe Bilotta
The custom CGI escaping done in esc_param 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. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-10-09gitweb: Do not show 'patch' link for merge commitsJakub Narebski
The 'patch' view is about generating text/plain patch that can be given to "git am", and "git am" doesn't understand merges anyway. Therefore link to 'patch' view should not be shown for merge commits. Also call to git-format-patch inside the 'patch' action would fail when 'patch' action is called for a merge commit, with "Reading git-format-patch failed" text as 'patch' view body. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-09-29gitweb: check given hash before trying to create snapshotMark Rada
Makes things nicer in cases when you hand craft the snapshot URL but make a typo in defining the hash variable (e.g. netx instead of next); you will now get an error message instead of a broken tarball. Tests for t9501 are included to demonstrate added functionality. Signed-off-by: Mark Rada <> Signed-off-by: Shawn O. Pearce <>
2009-09-07gitweb: Add 'show-sizes' feature to show blob sizes in tree viewJakub Narebski
Add support for 'show-sizes' feature to show (in separate column, between mode and filename) the size of blobs (files) in the 'tree' view. It passes '-l' option to "git ls-tree" invocation. For the 'tree' and 'commit' (submodule) entries, '-' is shown in place of size; for generated '..' "up directory" entry nothing is shown. The 'show-sizes' feature is enabled by default. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-09-01gitweb: Create links leading to 'blame_incremental' using JavaScriptJakub Narebski
The new 'blame_incremental' view requires JavaScript to run. Not all web browsers implement JavaScript (e.g. text browsers such as Lynx), and not all users have JavaScript enabled. Therefore instead of unconditionally linking to 'blame_incremental' view, we use JavaScript to convert those links to lead to view utilizing JavaScript, by adding 'js=1' to link. Currently the only action that takes 'js=1' into account is 'blame', which then acts as if it was called as 'blame_incremental' action. Possible enhancement would be to do JavaScript redirect by setting window.location instead of modifying $format and $action in git_blame_common() subroutine. The only JavaScript-aware/using view is currently 'blame_incremental'. While at it move reading JavaScript to git_footer_html() subroutine. Note that in this view we do not add 'js=1' currently (even though perhaps we should; note that for consistency we should also add 'js=1' in links added by JavaScript part of 'blame_incremental'). This idea was originally implemented by Petr Baudis in but it added <script> element with fixBlameLinks() function in page header, to be added as onload event using 'onload' attribute of HTML 'body' element: <body onload="fixBlameLinks();">. This version adds script at then end of page (in the page footer), and uses JavaScript 'window.onload=fixLinks();'. Also in Petr version only links marked with 'blamelink' class were modified, and they were modified by replacing "a=blame" by "a=blame_incremental"... which doesn't work for path_info links, and might replace wrong part if there is "a=blame" in project name, ref name or file name. Slightly different solution was implemented by Martin Koegler in Here GitAddLinks() function was in gitweb.js file, not as contents of <script> element. It was also included in page header (in <head> element) though, which means waiting for a script to load (and run). It was smarter in that to "fix" (modify) link, it split URL, modified value of 'a' parameter, and then recreated modified link. It avoids trouble with "a=blame" as substring in project name or file name, but it doesn't work with path_info URL/link in the way it was written. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-09-01gitweb: Incremental blame (using JavaScript)Jakub Narebski
Add 'blame_incremental' view, which uses "git blame --incremental" and JavaScript (Ajax), where 'blame' use "git blame --porcelain". * gitweb generates initial info by putting file contents (from "git cat-file") together with line numbers in blame table * then gitweb makes web browser JavaScript engine call startBlame() function from gitweb.js * startBlame() opens XMLHttpRequest connection to 'blame_data' view, which in turn calls "git blame --incremental" for a file, and streams output of git-blame to JavaScript (gitweb.js) * XMLHttpRequest event handler updates line info in blame view as soon as it gets data from 'blame_data' (from server), and it also updates progress info * when 'blame_data' ends, and gitweb.js finishes updating line info, it fixes colors to match (as far as possible) ordinary 'blame' view, and updates information about how long it took to generate page. Gitweb deals with streamed 'blame_data' server errors by displaying them in the progress info area (just in case). The 'blame_incremental' view tries to be equivalent to 'blame' action; there are however a few differences in output between 'blame' and 'blame_incremental' view: * 'blame_incremental' always used query form for this part of link(s) which is generated by JavaScript code. The difference is visible if we use path_info link (pass some or all arguments in path_info). Changing this would require implementing something akin to href() subroutine from gitweb.perl in JavaScript (in gitweb.js). * 'blame_incremental' always uses "rowspan" attribute, even if rowspan="1". This simplifies code, and is not visible to user. * The progress bar and progress info are still there even after JavaScript part of 'blame_incremental' finishes work. Note that currently no link generated by gitweb leads to this new view. This code is based on patch by Petr Baudis <> patch, which in turn was tweaked up version of Fredrik Kuivinen <>'s proof of concept patch. This patch adds GITWEB_JS compile configuration option, and modifies to take gitweb.js into account. The code for was taken from Pasky's patch. Signed-off-by: Fredrik Kuivinen <> Signed-off-by: Petr Baudis <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-09-01gitweb: Add optional "time to generate page" info in footerJakub Narebski
Add "This page took XXX seconds and Y git commands to generate" to page footer, if global feature 'timed' is enabled (disabled by default). Requires Time::HiRes installed for high precision 'wallclock' time. Note that Time::HiRes is being required unconditionally; this is because setting $t0 variable needs to be done fairly early to have running time of the whole script. If Time::HiRes module were required only if 'timed' feature is enabled, the earliest place where starting time ($t0) could be calculated would be after reading gitweb config, making "time to generate page" info inaccurate. This code is based on example code by Petr 'Pasky' Baudis. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-09-01Merge branch 'mr/gitweb-snapshot'Junio C Hamano
* mr/gitweb-snapshot: gitweb: add t9501 tests for checking HTTP status codes gitweb: split test suite into library and tests gitweb: improve snapshot error handling
2009-08-28Merge branch 'maint'Junio C Hamano
* maint: Fix overridable written with an extra 'e' Documentation: git-archive: mark --format as optional in summary Round-down years in "years+months" relative date view
2009-08-28Merge branch 'maint-1.6.3' into maintJunio C Hamano
* maint-1.6.3: Fix overridable written with an extra 'e' Documentation: git-archive: mark --format as optional in summary Round-down years in "years+months" relative date view
2009-08-28Merge branch 'maint-1.6.2' into maint-1.6.3Junio C Hamano
* maint-1.6.2: Fix overridable written with an extra 'e' Documentation: git-archive: mark --format as optional in summary Round-down years in "years+months" relative date view Conflicts: Documentation/git-archive.txt
2009-08-28Fix overridable written with an extra 'e'Nanako Shiraishi
Signed-off-by: Nanako Shiraishi <> Signed-off-by: Junio C Hamano <>
2009-08-25gitweb: improve snapshot error handlingMark Rada
The last check in the second block of checks in the &git_snapshot routine is never executed because the second to last check is a superset of the last check. Switch the order of the last two checks. It has the advantage of giving clients a more specific reason why they cannot get a snapshot format if the format they have chosen is disabled. Signed-off-by: Mark Rada <> Signed-off-by: Junio C Hamano <>
2009-08-24Merge branch 'mr/gitweb-xz'Junio C Hamano
* mr/gitweb-xz: gitweb: add support for XZ compressed snapshots gitweb: update INSTALL regarding specific snapshot settings gitweb: support to globally disable a snapshot format
2009-08-23gitweb: pull ref markes pull out of subject <a> elementGiuseppe Bilotta
Since 4afbaef (gitweb: ref markers link to named shortlogs, 2008-09-02), ref markers that accompany the subject in views such as shortlog and history point to something different from the subject itself. Therefore, they should not be included in the same <a> element. Benefits of the change are: * better compliance to the XHTML standards, that forbid links within links even though the restriction cannot be imposed via DTD; this also benefits visualization in some older browsers; * when hovering the subject, only the subject itself is underlined; when hovering the ref markers, only the text in the hovered ref marker is underlined; previously, hovering any written part of the subject column led to complete underlying of everything at the same time, with unpleasing effects. Signed-off-by: Giuseppe Bilotta <> Acked-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-08-14Merge branch 'jn/gitweb-blame' (early part)Junio C Hamano
* 'jn/gitweb-blame' (early part): gitweb: Use light/dark for class names also in 'blame' view gitweb: Add author initials in 'blame' view, a la "git gui blame" gitweb: Mark commits with no "previous" in 'blame' view gitweb: Use "previous" header of git-blame -p in 'blame' view gitweb: Mark boundary commits in 'blame' view gitweb: Make .error style generic
2009-08-11Merge branch 'zf/maint-gitweb-acname'Junio C Hamano
* zf/maint-gitweb-acname: gitweb: parse_commit_text encoding fix
2009-08-06gitweb: add support for XZ compressed snapshotsMark A Rada
The XZ compression format uses the LZMA2 compression algorithm, which often yields higher compression ratios than both GZip and BZip2 at the cost of using more CPU time and RAM. XZ is the slowest for compression, but still much faster than BZip2 for decompression, almost comparable to GZip (see benchmarks below). Some simple benchmarks show the pros and cons of using XZ compression; starting with an already tarball'd archive of the repos listed below. Memory usage seemed to be consistent for any given algorithm at their respective default compression levels. CPU: AMD Sempron 3400+ (1 core @ 1.8GHz with 256K L2 cache) Virtual Memory Usage GZip: 4152K BZip2: 13352K XZ: 102M Linux 2.6 series (f5886c7f96f2542382d3a983c5f13e03d7fc5259) 349M gzip 23.70s user 0.47s system 99% cpu 24.227 total 76M gunzip 3.74s user 0.74s system 94% cpu 4.741 total bzip2 130.96s user 0.53s system 99% cpu 2:11.97 total 59M bunzip2 31.05s user 1.02s system 99% cpu 32.355 total xz 448.78s user 0.91s system 99% cpu 7:31.28 total 51M unxz 7.67s user 0.80s system 98% cpu 8.607 total Git (0a53e9ddeaddad63ad106860237bbf53411d11a7) 11M gzip 0.77s user 0.03s system 99% cpu 0.792 total 2.5M gunzip 0.12s user 0.02s system 98% cpu 0.142 total bzip2 3.42s user 0.02s system 99% cpu 3.454 total 2.1M bunzip2 0.95s user 0.03s system 99% cpu 0.984 total xz 12.88s user 0.14s system 98% cpu 13.239 total 1.9M unxz 0.27s user 0.03s system 99% cpu 0.298 total XZ (669413bb2db954bbfde3c4542fddbbab53891eb4) 1.8M gzip 0.12s user 0.00s system 95% cpu 0.132 total 442K gunzip 0.02s user 0.00s system 97% cpu 0.027 total bzip2 1.28s user 0.01s system 99% cpu 1.298 total 363K bunzip2 0.15s user 0.01s system 100% cpu 0.157 total xz 1.62s user 0.03s system 99% cpu 1.652 total 347K unxz 0.05s user 0.00s system 99% cpu 0.058 total From a time and memory perspective, nothing compares to GZip, but if given an average upload speed of 20KB/s, it would take ~400 seconds longer to transfer the BZip2'd kernel snapshot than the XZ snapshot; the transfer time difference is even greater between GZip and XZ. The real time savings are relatively the same for all test cases, but less dramatic for smaller repositories. XZ decompresses ~1.8-2 times slower than GZip, and ~2.7-3.75 times faster than BZip2; XZ gets relatively faster as snapshots get larger. However, XZ takes relatively longer to compress as snapshots get larger. The downside for XZ'd snapshots is the large CPU and memory load put on the server to generate the compressed snapshot, though XZ will eventually have threading support, and the real clock time for making XZ'd snapshots would decrease if the server had a beefy multi-core CPU. XZ compression is disabled by default to allow upgrades to take place without any surprises, as the CPU and memory requirements will be an issue for high load or lightweight servers. Also, the XZ format is still new (format declared stable ~6 months ago), and there have been no "stable" releases of the utils yet. Signed-off-by: Mark Rada <> Signed-off-by: Junio C Hamano <>
2009-08-06gitweb: support to globally disable a snapshot formatMark A Rada
Allow Gitweb administrators to set a 'disabled' key in the %known_snapshot_formats hash to disable a specific snapshot format. All formats are enabled by default to maintain backwards compatibility. Signed-off-by: Mark Rada <> Signed-off-by: Junio C Hamano <>
2009-08-05gitweb: parse_commit_text encoding fixZoltán Füzesi
Call to_utf8 when parsing author and committer names, otherwise they will appear with bad encoding if they written by using chop_and_escape_str. Signed-off-by: Zoltán Füzesi <> Signed-off-by: Junio C Hamano <>
2009-08-04gitweb: fix 'Use of uninitialized value' error in href()Giuseppe Bilotta
Equality between file_parent and file_name was being checked without a preliminary check for existence of the parameters. Fix by wrapping the equality check in appropriate if (defined ...), rearranging the lines to prevent excessive length. Signed-off-by: Giuseppe Bilotta <> Acked-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-25gitweb: Use light/dark for class names also in 'blame' viewJakub Narebski
Instead of using "light2" and "dark2" for class names in 'blame' view (in place of "light" and "dark" classes in other places) to avoid changing style on hover in 'blame' view while doing it for other views (like 'shortlog'), use more advanced CSS, relying on the fact that more specific selector wins. While at it add a few comments to gitweb CSS file, and consolidate some repeated info. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-25gitweb: Add author initials in 'blame' view, a la "git gui blame"Jakub Narebski
For example for "Junio C Hamano" initials would be "JH". Of course initials are added (below shortened SHA-1 of blamed commit) only if group of lines that blame the same commit has 2 or more lines in it. Initials are extracted using i18n /\b([[:upper:]])\B/g regexp. Additionally initials help to distinguish boundary commits, as they use bold weight font too (in addition to shortened SHA-1 of commit). Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-25gitweb: Mark commits with no "previous" in 'blame' viewJakub Narebski
Use "no-previous" class to mark blamed commits which do not have "previous" header. Those are commits in which blamed file was created (added); this includes boundary commits. This means that 'linenr' link leads to blamed commit, not (one of) parent of blamed commit. Therefore currently line number for such commit uses bold weight font to denote this situation; the effect is subtle. Use "multiple-previous" class in the opposite situation, where blamed commit has multiple "previous" headers (is an evil merge). Currently this class is not used for styling. In this situation 'linenr' link leads to first of "previous" commits (first parent). Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-25gitweb: Use "previous" header of git-blame -p in 'blame' viewJakub Narebski
Luben Tuikov changed 'lineno' link (line number link) from pointing to 'blame' view at given line at blamed commit, to the one at parent of blamed commit in 244a70e (Blame "linenr" link jumps to previous state at "orig_lineno", 2007-01-04). This made it possible to do data mining using 'blame' view, by going through history of a line using mentioned line number link. Original implementation called "git rev-parse <commit>^" to find SHA-1 of a parent of a given commit once per each blamed line. In 39c19ce (gitweb: cache $parent_commit info in git_blame(), 2008-12-11) this was improved so rev-parse was called once per each unique commit in git-blame output. Alternate solution would be to relax validation for 'hb' parameter by allowing extended SHA-1 syntax of the form <rev>^ (perhaps redirecting to gitweb URL with <rev>^ resolved, in practice moving call to rev-parse to 'the other side of link'). This solution had a bug that it didn't work for boundary commits. Boundary commits don't have parents, so "git rev-parse <commit>^" returned literal "<commit>^" (which didn't exists). Gitweb didn't detect this situation and passed this result literally as 'hb' parameter in 'linenr' link. Following such link currently gives 400 - Invalid hash base parameter error; 'hb' parameter is restricted via validate_refname to correct refnames and doesn't allow for extended SHA-1 syntax. This bug could have been fixed alternatively by checking if commit is boundary commit, or check if rev-parse result is unchanged (still ends in '^' prefix). The solution employing rev-parse to find parent of commit had inherent problem if blamed commit renamed file; then name of file would be different in its parent. Solving this outside git-blame would be difficult and costly (at least cost of additional fork for extra git command). Currently gitweb uses information in "previous" header, which was introduced by Junio C Hamano in 96e1170 (blame: show "previous" information in --porcelain/--incremental format, 2008-06-04) This (currently undocumented) header has the following format: "previous <sha1 of parent commit> <filename at parent>" Using "previous" header solves both problem of performance and the problem that blamed commit could have renaming blamed file. Because "previous" header can be repeated for the same commit when blamed commit is merge (has more than one parent), and we are interested usually in _first_ parent, currently we store only first value if blame header repeats. Using first parent (first "previous" line) was what gitweb did before; without this change gitweb would use last parent instead. If there is no previous commit 'linenr' link points to blamed commit and blamed filename, making it work correctly for boundary commits. Acked-by: Luben Tuikov <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-25gitweb: Mark boundary commits in 'blame' viewJakub Narebski
Use "boundary" class to mark boundary commits, which currently results in using bold weight font for SHA-1 of a commit (to be more exact for all text in the first cell in row, that contains SHA-1 of a commit). Detecting boundary commits is done by watching for "boundary" header in "git blame -p" output. Because this header doesn't carry additional data the regular expression for blame header fields had to be slightly adjusted. With current gitweb API only root (parentless) commits can be boundary commits. Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-07-13gitweb: update Git homepage URLWincent Colaiuta is now the "official" Git project page, having taken over from, so update the default link accordingly. This saves a redirect when people hit Signed-off-by: Wincent Colaiuta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: add empty alt text to avatar imgGiuseppe Bilotta
The empty alt text optimizes screen estate in text-only browsers. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: picon avatar providerGiuseppe Bilotta
Simple implementation of picon that only relies on the database. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: gravatar url cacheGiuseppe Bilotta
Views which contain many occurrences of the same email address (e.g. shortlog view) benefit from not having to recalculate the MD5 of the email address every time. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: (gr)avatar supportGiuseppe Bilotta
Introduce avatar support: the feature adds the appropriate img tag next to author and committer in commit(diff), history, shortlog, log and tag views. Multiple avatar providers are possible, but only gravatar is implemented at the moment. Gravatar support depends on Digest::MD5, which is a core package since Perl 5.8. If gravatars are activated but Digest::MD5 cannot be found, the feature will be automatically disabled. No avatar provider is selected by default, except in the t9500 test. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: use git_print_authorship_rows in 'tag' view tooGiuseppe Bilotta
parse_tag must be adapted to use the hash keys expected by git_print_authorship_rows. This is not a problem since git_tag is the only user of this sub. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: uniform author info for commit and commitdiffGiuseppe Bilotta
Switch from 'log'-like layout A U Thor <> [date time] to 'commit'-like layout author A U Thor <> date time committer C O Mitter <> committer date time Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-06-30gitweb: refactor author name insertionGiuseppe Bilotta
Collect all author display code in appropriate functions, making it easier to extend these functions on the CGI side. We also move some of the presentation code from hard-coded HTML to CSS, for easier customization. A side effect of the refactoring is that now localtime is always displayed with the 'at night' warning. Signed-off-by: Giuseppe Bilotta <> Signed-off-by: Junio C Hamano <>
2009-05-23Merge branch 'jn/gitweb-cleanup'Junio C Hamano
* jn/gitweb-cleanup: gitweb: Remove unused $hash_base parameter from normalize_link_target gitweb: Simplify snapshot format detection logic in evaluate_path_info gitweb: Use capturing parentheses only when you intend to capture gitweb: Replace wrongly added tabs with spaces gitweb: Use block form of map/grep in a few cases more gitweb: Always use three argument form of open gitweb: Always use three argument form of open gitweb: Do not use bareword filehandles
2009-05-22gitweb: Sanitize title attribute in format_subject_htmlJakub Narebski
Replace control characters with question mark '?' (like in chop_and_esc_str). A little background: some web browsers turn on strict (and unforgiving) XML validating mode for XHTML documents served using application/xhtml+xml content type. This means among others that control characters are forbidden to appear in gitweb output. does by default slight escaping (using simple_escape subroutine from CGI::Util) of all _attribute_ values (depending on the value of autoEscape, by default on). This escaping, at least in version 3.10 (most current version at CPAN is 3.43), is minimal: only '"', '&', '<' and '>' are escaped using named HTML entity references (&quot;, &amp;, &lt; and &gt; respectively). But simple_escape does not do escaping of control characters such as ^X which are invalid in XHTML (in strict mode). If by some accident commit message do contain some control character in first 50 characters (more or less) of first line of commit message, and this line is longer than 50 characters (so gitweb shortens it for display), then gitweb would put this control character in title attribute (and would not remove them). The tag _contents_ is safe because it is escaped using esc_html() explicitly, and it replaces control characters by their printable representation. While at it: chop_and_escape_str doesn't need capturing group. Noticed-by: Paul Gortmaker <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>