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 <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
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>
Michael G. Noll said in comments to the "Switching my code repository from
Subversion (SVN) to git" article (http://tinyurl.com/37v67l) in his "My
digital moleskine" blog, that one of the things he is missing in gitweb
from SVN::Web is an RSS feed with news/information of the current view
(including RSS feed for single file or directory).
This is not exactly true, as since refactoring feed generation in af6feeb
(gitweb: Refactor feed generation, make output prettier, add Atom feed,
2006-11-19), gitweb can generate feeds (RSS or Atom) for history of a
given branch, history limited to a given directory, or history of a given
file. Nevertheless this required handcrafting the URL to get wanted RSS
feed.
This commit makes gitweb select feed links in the HTML header and in
page footer depending on current view (action). It is more elaborate,
and I guess more correct, than simple patch adding $hash ('h')
parameter to *all* URLs, including feed links, by Jean-Baptiste Quenot
Subject: [PATCH] gitweb: Add hash parameter in feed URL when a hash
is specified in the current request
Message-ID: <ae63f8b50803211138y6355fd11pa64cda50a1f53011@mail.gmail.com>
If $hash ('h') or $hash_base ('hb') parameter is a branch name
(i.e. it starts with 'refs/heads/'; all generated URLs use this form
to discriminate between tags and heads), it is used in feed URLs; if
$file_name ('f') is defined, it is used in feed URLs. Feed title is
set according to the kind of web feed: it is either 'log' for generic
feed, 'log of <branch>', 'history of <filename>' for generic history
(using implicit or explicit HEAD, i.e. current branch) or 'history of
<filename> on <branch>'.
There are special cases: 'heads' and 'forks' views should use OPML
providing list of available feeds; 'tags' probably also should use
OPML; there is no web feed equivalent to 'search' view. Currently all
those cases fallback to (show) default feed. Such feed link uses
"generic" class, and is shown in slightly lighter color for
distinction.
Currently feed can have but one starting point, and does not support
negative (exclude) commit arguments. Therefore for now for *diff
views it is chosen that feed follow the "to" part: to-name, to-commit
for 'blobdiff', 'treediff' and 'commitdiff' views.
Generating parameters for href() for feed link was separated
(refactored) into get_feed_info() subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Put (optional) projects README on "summary" page in <div> element
using "readme" class. This allow to style it using CSS.
Add padding to project's README to make it line out with the rest
of the page.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Remove all cellspacing="0" attributes from tables in gitweb,
replacing it by CSS rule. Add CSS classes for all tables.
While at it, change class(es) of table for commit message and commit
authorship search from "grep" to "commit_search"; similarly,
"grep_search" class is now used for table with results of grep (files)
search.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Currently, searchbox is CSS'd to have position: absolute, which has the
unfortunate consequence that if the viewport is too small and can't fit
into the page width together with the navbar, it gets overlapped and part
of the navbar gets obscured. This makes searchbox float: right instead,
thus the navbar simply gets wrapped.
Discovered and fix pointed out by Michael Olson <mwolson@gnu.org>.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A missing return statement in git_get_last_activity made gitweb think
a project with no commits was in age class "age0", so the "No commits"
appeared in bold green, which was ridiculous. I added the return so
those projects get "noage" and added a block to gitweb.css to format
the "No commits" text gray.
Signed-off-by: Matt McCutchen <hashproduct@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since commit-fb1dde4a we show combined diff for merges in 'commitdiff'
view, and since commit-208ecb2e also in 'commit' view. Sometimes
though one would want to see diff to one of merge commit parents. It
is easy in 'commit' view: in the commit header part there are "diff"
links for each of parent header. This commit adds such links also for
'commitdiff' view.
Add to difftree / whatchanged table row with "1", "2", ... links to
'commitdiff' view for diff with n-th parent for merge commits, as a
table header. This is visible only in 'comitdiff' view, and only for
a merge commit (comit with more than one parent).
To save space links are shown as "n", where "n" is number of a parent,
and not as for example shortened (to 7 characters) sha1 of a parent
commit. To make it easier to discover what links is for, each link
has 'title' attribute explaining the link.
Note that one would need to remember that difftree table in 'commit'
view has one less column (it doesn't have "patch" link column), if one
would want to add such table header also in 'commit' view.
Example output:
1 2 3
Makefile patch | diff1 | diff2 | diff3 | blob | history
cache.h patch | diff1 | diff2 | diff3 | blob | history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The 'grep' type of search greps the currently selected tree for given
regexp and shows the results in a fancy table with links into blob view.
The number of shown matches is limited to 1000 and the whole feature
can be turned off (grepping linux-2.6.git already makes repo.or.cz a bit
unhappy).
This second revision makes it in documentation explicit that grep accepts
regexps, and makes grep accept extended regexps instead of basic regexps.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
David Kågedal proposed that gitweb should explicitely request
being somewhat smaller than normal, because it has good use for
long lines. However gitweb presents a table with several
columns, so having wider line is OK for it. Therefore explicit
'font-size: small' would make sense. Apparently many people on
the list seem to agree with him.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Avoid specifying font sizes in pixels, since that is just pure evil.
Pointed out by Chris Riddoch.
Note that this is pretty much just a proposal; I didn't test if everything
fits perfectly right, but things seem to be pretty much okay. repo.or.cz
uses it now as a test drive - if you find any visual quirks, please point
them out, with a patch if possible since I'm total CSS noob and debugging
CSS is an extremely painful experience for me.
Note that this patch actually does change visual look of gitweb in Firefox
with my resolution and default settings - everything is bigger and I can't
explain the joy of actually seeing gitweb text that is in _readable_ size;
also, my horizontal screen real estate feels better used now. But judging
from the look of most modern webpages on the 'net, most people prefer
reading the web with strained eyes and/or a magnifying glass (I wonder what
species of scientists should look into this mystifying phenomenon) - so,
please tell us what you think.
Maybe we might want to get rid of absolute sizes other than font sizes in
the CSS file too in the long term.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
You have to pass all parents as final parameters of git_difftree_body
subroutine; the number of parents of a diff must be equal to the
number derived from parsing git-diff-tree output, raw combined diff
for git_difftree_body to display combined diff correctly (but it is
not checked).
Currently the possibility of displaying diffree of combined diff is
not used in gitweb code; git_difftree_body is always caled for
ordinary diff, and with only one parent.
Description of output for combined diff:
----------------------------------------
The difftree table for combined diff starts with a cell with pathname
of changed blob (changed file), which if possible is hidden link
(class="list") to the 'blob' view of final version (if it exists),
like for difftree for ordinary diff. If file was deleted in the final
commit then filename is not hyperlinked.
There is no cell with single file status (new, deleted, mode change,
rename), as for combined diff as there is no single status: different
parents might have different status.
If git_difftree_body was called from git_commitdiff (for 'commitdiff'
action) there is inner link to anchor to appropriate fragment (patch)
in patchset body; the "patch" link does not replace "diff" link like
for ordinary diff.
Each of "diff" links is in separate cell, contrary to output for
ordinary diff in which all links are (at least for now) in a single
cell.
For each parent, if file was not present we leave cell empty. If file
was deleted in the result, we provide link to 'blob' view. Otherwise
we provide link to 'commitdiff' view, even if patch (diff) consist
only of extended diff header, and contents is not changed (pure
rename, pure mode change). The only difference is that link to
"blobdiff" view with no contents change is with 'nochange' class.
At last, there is provided link to current version of file as "blob"
link, if the file was not deleted in the result, and lik to history of
a file, if there exists one. (The link to file history might be
confused, at least for now, by renames.)
Note that git-diff-tree raw output dor combined diff does not provide
filename before change for renames and copies; we use
git_get_path_by_hash to get "src" filename for renames (this means
additional call to git-ls-tree for a _whole_ tree).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Currently, gitweb shows only header and footer, if no differences are
found. This patch adds a "No differences found" message for the html
output.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The CSS selector for signoff lines style was too strict: in the "log"
view the commit message is not encompassed in container "page_body"
div.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
If we have provided enough info, and diff is not combined diff,
and if provided diff line is chunk header, then:
* split chunk header into .chunk_info and .section span elements,
first containing proper chunk header, second section heading
(aka. which function), for separate styling: the proper chunk
header is on non-white background, section heading part uses
slightly lighter color.
* hyperlink from-file-range to starting line of from-file, if file
was not created.
* hyperlink to-file-range to starting line of to-file, if file
was not deleted.
Links are of invisible variety (and "list" class).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Replace "gitweb diff header" with its full sha1 of blobs and replace
it by "git diff" header and extended diff header. Change also somewhat
highlighting of diffs.
Added `file_type_long' subroutine to convert file mode in octal to
file type description (only for file modes which used by git).
Changes:
* "gitweb diff header" which looked for example like below:
file:_<sha1 before>_ -> file:_<sha1 after>_
where 'file' is file type and '<sha1>' is full sha1 of blob is
changed to
diff --git _a/<file before>_ _b/<file after>_
In both cases links are visible and use default link style. If file
is added, a/<file> is not hyperlinked. If file is deleted, b/<file>
is not hyperlinked.
* there is added "extended diff header", with <path> and <hash>
hyperlinked (and <hash> shortened to 7 characters), and <mode>
explained: '<mode>' is extended to '<mode> (<file type description>)',
where added text is slightly lighter to easy distinguish that it
was added (and it is difference from git-diff output).
* from-file/to-file two-line header lines have slightly darker color
than removed/added lines.
* chunk header has now delicate line above for easier finding chunk
boundary, and top margin of 2px, both barely visible.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Extend unquote subroutine, which unquotes quoted and escaped filenames
which git may return, to deal not only with octal char sequence
quoting, but also quoting ordinary characters including '\"' and '\\'
which are respectively quoted '"' and '\', and to deal also with
C escape sequences including '\t' for TAB and '\n' for LF.
Add esc_path subroutine for gitweb quoting and HTML escaping filenames
(currently it does equivalent of ls' --hide-control-chars, which means
showing undisplayable characters (including '\n' and '\t') as '?'
(question mark) character, and use 'span' element with cntrl CSS class
to help rendering them differently.
Convert gitweb to use esc_path correctly to print pathnames.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This makes the multiple search types actually usable by the user;
if you don't read the gitweb source, you don't even have an idea
that you can write things like that there.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Rename $githelp_url and $githelp_label to $logo_url and $logo_label to
be more obvious what they refer to; while at it add commented out
previous contents (git documentation at kernel.org). Add comment about
logo size.
Use $cgi->a(...) to generate Git logo link; it automatically escapes
attribute values when it is needed. Escape href attribute using
esc_url instead of (incorrect!) esc_html.
Move styling of git logo <img> element from "style" attribute to CSS
via setting class to "logo". Perhaps we should set it by id rather
than by class.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Minimize vertical table row padding for blame only. I
discovered this while having the browser's blame output
right next to my editor's window, only to notice how much
vertically stretched the blame output was.
Blame most likely shows source code and is in this way
more "spartan" than the rest of the tables gitweb shows.
This patch makes the blame table more vertically compact,
thus being closer to what you'd see in your editor's window,
as well as reusing more window estate to show more
information (which in turn minimizes scrolling).
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add subroutine git_print_authorship to print author and date of
commit, div.author_date style to CSS, and use them in git_commitdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change replacing hashes as from-file/to-file with filenames from
difftree to adding invisible (except underlining on hover/mouseover)
hyperlink to from-file/to-file blob. /dev/null as from-file or
to-file is not changed (is not hyperlinked).
This makes two-file from-file/to-file unified diff header parsing in
git_patchset_body more generic, and not only for legacy blobdiffs.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Parse two-line from-file/to-file unified diff header in
git_patchset_body directly, instead of leaving pretty-printing to
format_diff_line function. Hashes as from-file/to-file are replaced
by proper from-file and to-file names (from $diffinfo); in the future
we can put hyperlinks there. This makes possible to do blobdiff with
only blobs hashes.
The lines in two-line unified diff header have now class "from_file"
and "to_file"; the style is chosen to match previous output (classes
"rem" and "add" because of '-' and '+' as first character of patch
line).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
In format_diff_line, instead of skipping errors/incomplete lines,
for example
"\ No newline at end of file"
in HTML pretty-printing of diff, use "incomplete" class for div.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Fix regression introduced by
commit 17d0744318.
"a.list" being "bold", makes a myriad of things shown by
gitweb in bold font-weight, which is a regression from
pre-17d07443188909ef5f8b8c24043cb6d9fef51bca behavior.
The fix is to add "subject" class and use this class
to replace pre-format_subject_html formatting of subject
(comment) via using (or not) <b>...</b> element. This
should go back to the pre-17d0744318... style.
Regression noticed by Luben Tuikov.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separate printing difftree in git_commit into separate
git_difftree_body subroutine. Add support for "C" (copied) status. For
"M" and "C" add parameter 'fp' (filename parent) to the "diff" link;
currently not supported by git_blobdiff ("blobdiff" action).
Reindented, realigned, added comments.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change git_get_references to include type of ref in the %refs value, which
means putting everything after 'refs/' as a ref name, not only last
part of the name. Instead of separating refs pointing to the same
object by " / " separator, use anonymous array reference to store all
refs pointing to given object.
Use 'git-ls-remote .' if $projectroot/$project/info/refs does not
exist. (Perhaps it should be used always.)
Refs are now in separate span elements. Class is dependent on the ref
type: currently known classes are 'tag', 'head', 'remote', and 'ref'
(last one for HEAD and other refs in the main directory). There is
encompassing span element of class refs, just in case of unknown ref
type.
This might be considered cleaner separating of git_get_references into
filling %refs hash only, and not taking part in formatting ref marker.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separate printing of perhaps shortened title (subject) in
git_shortlog_body and git_tags_body into format_subject_html.
While at it, remove presentation element <b>...</b> used to format
title (subject) and move formatting to CSS.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Until now blame just used the commit/tree/tags/etc style of
highlight-able table rows, which have alternating light/dark rows that
flash when mouse pointer passes over them. This is very annoying in
blame, since the text is static and it interferes with the
per-revision block highlighting.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add git_shortlog_body, git_tags_body and git_heads_body to generate
table with shortlog, tags and heads respectively in git_summary and
git_shortlog, git_tags, git_heads respectively.
Better support for lightweight tags in git_read_refs; currently only
lightweight tag pointing to tag object is not resolved fully.
Shortlog, tags and heads body tables have proper class now (we could
use id instead of class).
Add support for showing full comment on mouseover to tags list when
comment is shortened, similar to how full title of commit was/is
shown on mouseover when title was shortened. Changed layout of tags
table to better show lightweight tags.
Add showing which branch (head) is current branch (current head),
using "current_head" class (we could use id instead).
Corrected "</table\n>" and hit_header_div instead of git_header_div.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use monospace fonts for the commit header, commit message,
and tree-diff. This helps viewing commit logs with ASCII art.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Do not use tabs to align variable initialization (actually use
tabs only at the beginning of line, for code indent). Remove trailing
whitespace. Make whitespace usage more consistent.
Signed-off-by: Jakub Narebski <jnareb.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Replace (almost) all 'style' attributes with 'class' attribute
and adding rule to CSS file. Some tables use CSS for styling
instead of legacy styling attributes.
[jc: too many rejects -- hand fixed and reindented]
Taken from git://git.xmms.se/xmms2/gitweb-xmms2.git
commit 561262030d58a6325f500b36d836dbe02a5abc68
"Make CSS readable" by Daniel Svensson, with extra
parts removed and consistent whitespace usage.
[jc: tabified the results to cleaning things up, and removed an
added item that was commented out. ]
Signed-off-by: Junio C Hamano <junkio@cox.net>
Move gitweb style from embedded <style> element in gitweb/gitweb.cgi
to external CSS file gitweb/gitweb.css.
Signed-off-by: Junio C Hamano <junkio@cox.net>