Commit Graph

469 Commits

Author SHA1 Message Date
Matt McCutchen
40375a83d2 gitweb: make search form generate pathinfo-style URLs
The search form generated traditional-style URLs with a "p=" parameter
even when the pathinfo feature was on.  This patch makes it generate
pathinfo-style URLs when appropriate.

Signed-off-by: Matt McCutchen <hashproduct@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-07 14:18:29 -07:00
Miklos Vajna
76e4f5d025 gitweb: prefer git_get_project_owner() over get_file_owner()
This way if $projects_list exists, it'll be used, otherwise get_file_owner()
will be used as before.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-07 14:18:29 -07:00
Junio C Hamano
478524508e gitweb: make repeated calls to git_get_project_owner() bearable
If repeated calls to git_get_project_owner() are made, we would have read the
same file over and over again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-07 14:18:13 -07:00
Matthias Lederhofer
9a7d941056 gitweb: change filename/directory name of snapshots
/.git or .git is removed from the project name and the
basename of the remaining path is used as the beginning of
the filename and as the directory in the archive.

The regexp will actually not strip off /.git or .git if there
wouldn't be anything left after removing it.

Currently the full project name is used as directory in the
archive and the basename is used as filename.  For example a
repository named foo/bar/.git will have a archive named
.git-<version>.* and extract to foo/bar/.git.  With this patch
the file is named bar-<version>.* and extracts to bar.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12 22:22:06 -07:00
Jakub Narebski
cd030c3a70 gitweb: '--cc' for merges in 'commitdiff' view
Allow choosing between '-c' (combined diff) and '--cc' (compact
combined) diff format in 'commitdiff' view for merge (multiparent)
commits.  Default is now '--cc'.

In the bottom part of navigation bar there is link allowing to change
diff format: "combined" for '-c' (when using '--cc') and "compact" for
'--cc' (when using '-c'), just on the right of "raw" link to
'commitdiff_plain" view.

About patchset part of diff --cc output: the difftree (whatchanged
table) has "patch" links to anchors to individual patches (on the same
page). The --cc option further compresses the patch output by
omitting some hunks; when this optimization makes all hunks disappear,
the patch is not shown (like in any other "empty diff" case). But the
fact that patch has been simplified out is not reflected in the raw
(difftree) part of diff output; the raw part is the same for '-c' and
'--cc' options. As correcting difftree is rather out of the question,
as it would require scanning patchset part before writing out
difftree, we add "Simple merge" empty diffs as a place to have anchor
to in place of those simplified out and removed patches.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-10 16:57:48 -07:00
Jakub Narebski
91af4ce4ec gitweb: Add links to blobdiffs in from-file/to-file header for merges
Add links to diff to file ('blobdiff' view) for each of individual
versions of the file in a merge commit to the from-file/to-file header
in the patch part of combined 'commitdiff' view for merges.

The from-file/to-file header for combined diff now looks like:

  --- _1_/_git-gui/git-gui.sh_
  --- _2_/_git-gui.sh_
  +++ b/_git-gui/git-gui.sh_

where _<filename>_ link is link to appropriate version of a file
('blob' view), and _<n>_ is link to respective diff to mentioned
version of a file ('blobdiff' view). There is even hint provided in
the form of title attribute.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-10 16:57:48 -07:00
Jakub Narebski
deaa01a9f5 gitweb: Create special from-file/to-file header for combined diff
Instead of using default, diff(1) like from-file/to-file header for
combined diff (for a merge commit), which looks like:

  --- a/git-gui/git-gui.sh
  +++ b/_git-gui/git-gui.sh_

(where _link_ denotes [hidden] hyperlink), create from-file(n)/to-file
header, using "--- <n>/_<filename>_" for each of parents, e.g.:

  --- 1/_git-gui/git-gui.sh_
  --- 2/_git-gui.sh_
  +++ b/_git-gui/git-gui.sh_

Test it on one of merge commits involving rename, e.g.
  95f97567c1887d77f3a46b42d8622c76414d964d (rename at top)
  5bac4a6719 (file from one branch)

This is mainly meant to easier see renames in a merge commit.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-10 16:57:48 -07:00
Jakub Narebski
90921740bd gitweb: Split git_patchset_body into separate subroutines
This commit makes git_patchset_body easier to read, and reduces level of
nesting and indent level. It adds more lines that it removes because of
extra parameter passing in subroutines, and subroutine calls in
git_patchset_body. Also because there are few added comments.

Below there are descriptions of all split-off subroutines:

Separate formatting "git diff" header into format_git_diff_header_line.
While at it fix it so it always escapes pathname. It would be even more
useful if we decide to use `--cc' for merges, and need to generate by
hand empty patches for anchors.

Separate formatting extended (git) diff header lines into
format_extended_diff_header_line. This one is copied without changes.

Separate formatting two-lines from-file/to-file diff header into
format_diff_from_to_header subroutine. While at it fix it so it always
escapes pathname. Beware calling convention: it takes _two_ lines.

Separate generating %from and %to hashes (with info used among others to
generate hyperlinks) into parse_from_to_diffinfo subroutine. This one is
copied without changes.

Separate checking if file was deleted (and among others therefore does
not have link to the result file) into is_deleted subroutine. This would
allow us to easily change the algotithm to find if file is_deleted in
the result.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-10 16:57:48 -07:00
Jakub Narebski
ada3e1f733 gitweb: Improve "next" link in commitdiff view
Check if 'hp' (hash_parent) parameter to 'commitdiff' view is one of
'h' (hash) commit parents, i.e. if commitdiff is of the form
"<commit>^<n> <commit>", and mark it as such in the bottom part of
navigation bar. The "next" link in commitdiff view was introduced
in commit 151602df00

If 'hb' is n-th parent of 'h', show the following at the bottom
of navigation bar:
  (from parent n: _commit_)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-10 16:57:48 -07:00
Jakub Narebski
47598d7a49 gitweb: Provide links to commitdiff to each parent in 'commitdiff' view
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>
2007-06-10 16:57:48 -07:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Martin Koegler
00f429af7b gitweb: Handle non UTF-8 text better
gitweb assumes that everything is in UTF-8. If a text contains invalid
UTF-8 character sequences, the text must be in a different encoding.

This commit introduces $fallback_encoding which would be used as input
encoding if gitweb encounters text with is not valid UTF-8.

Add basic test for this in t/t9500-gitweb-standalone-no-errors.sh

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Tested-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Ismail Dönmez <ismail@pardus.org.tr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-03 16:51:53 -07:00
Mark Levedahl
072570ee26 gitweb.perl - Optionally send archives as .zip files
git-archive already knows how to generate an archive as a tar or a zip
file, but gitweb did not. zip archvies are much more usable in a Windows
environment due to native support and this patch allows a site admin the
option to deliver zip rather than tar files. The selection is done by
inserting

    $feature{'snapshot'}{'default'} = ['x-zip', 'zip', ''];

in gitweb_config.perl.

Tar files remain the default option.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-23 15:09:49 -07:00
Jakub Narebski
c906b18122 gitweb: Fix "Use of uninitialized value" warning in git_feed
Initial (root) commit has no parents, and $co{'parent'} is
undefined. Use '--root' for initial commit.

This fixes "Use of uninitialized value in open at gitweb/gitweb.perl
line 4925." warning.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-18 19:49:45 -07:00
Petr Baudis
7f79b0173d gitweb: Remove redundant $searchtype setup
Sorry, this was inadverently introduced by my grep search patch. It causes
annoying "redefined" warnings.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-18 17:12:36 -07:00
Petr Baudis
4229aa5141 gitweb: Allow arbitrary strings to be dug with pickaxe
Currently, there are rather draconian restrictions on the strings accepted
by the pickaxe search, which degrades its usefulness for digging in code
significantly. This patch remedies mentioned limitation.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-17 17:37:31 -07:00
Petr Baudis
e773855372 gitweb: Add support for grep searches
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>
2007-05-17 17:37:31 -07:00
Petr Baudis
d77b5673e9 gitweb: Normalize searchbar font size
Currently, searchbar font was as big as the page heading font, because
font-size was made relative - but to the parent element, which was for some
reason indeed page_header. Since that seems to be illogical to me, I just
moved the div.search outside of div.page_header. I'm no CSS/DOM expert but
no adverse effects were observed by me.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-17 17:37:30 -07:00
Jakub Narebski
5f85505265 gitweb: Fix error in git_patchset_body for deletion in merge commit
Checking if $diffinfo->{'status'} is equal 'D' is no longer the way to
check if the file was deleted in result.  For merge commits
$diffinfo->{'status'} is reference to array of statuses for each
parent.  Use the fact that $diffinfo->{'to_id'} is all zeros as sign
that file was deleted in result.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-17 17:35:33 -07:00
Junio C Hamano
2eb54efc6c gitweb: fix another use of undefined value
Pasky and Jakub competed fixing these and in the confusion this ended up
not being covered.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-16 21:04:16 -07:00
Jakub Narebski
d26c4264e5 gitweb: Empty patch for merge means trivial merge, not no differences
Earlier commit 4280cde95f made gitweb
show "No differences found" message for empty diff, for the HTML
output. But for merge commits, either -c format we use or --cc format,
empty diff doesn't mean no differences, but trivial merge.

Show "Trivial merge" message instead of "No differences found" for
merges.

While at it reword conditional in the code for easier reading.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-16 16:13:42 -07:00
Jakub Narebski
7e431ef9ab gitweb: Separate search regexp from search text
Separate search text, which is saved in $searchtext global variable,
and is used in links, as default value for the textfield in search
form, and for pickaxe search, from search regexp, which is saved in
$search_regexp global variable, and is used as parameter to --grep,
--committer or --author options to git-rev-list, and for searching
commit body in gitweb.  For now $search_regexp is unconditionallt
equal to quotemeta($searchtext), meaning that we always search for
fixed string.

This fixes bug where 'next page' links for 'search' view didn't work
for searchtext containing quotable characters, like `@'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-16 12:40:06 -07:00
Jakub Narebski
b211c320eb gitweb: Do not use absolute font sizes
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>
2007-05-16 12:40:06 -07:00
Junio C Hamano
3545193735 Merge branch 'maint'
* maint:
  Prepare for 1.5.1.5 Release Notes
  gitweb: Add a few comments about %feature hash
  git-am: Clean up the asciidoc documentation
  Documentation: format-patch has no --mbox option
  builtin-log.c: Fix typo in comment
  Fix git-clone buglet for remote case.
2007-05-14 18:50:01 -07:00
Jakub Narebski
b4b20b2164 gitweb: Add a few comments about %feature hash
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-14 17:26:46 -07:00
Jakub Narebski
785cdea9be gitweb: Fix "Use of unitialized value" warnings in empty repository
Fix it so gitweb doesn't write "Use of unitialized value..." warnings
(which gets written in web server logs) for empty (no commits)
repository.

In empty repository "last change" (last activity) doesn't make sense;
also there is no sense in parsing commits which aren't there.

In projects list for empty repositories gitweb now writes "No commits"
using "noage" class, instead of leaving cell empty, in the last change
column.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-13 18:22:54 -07:00
Jakub Narebski
198a2a8a69 gitweb: Check if requested object exists
Try to avoid "Use of uninitialized value ..." errors caused by bad
revision, incorrect filename, wrong object id, bad file etc. (wrong
value of 'h', 'hb', 'f', etc. parameters). This avoids polluting web
server errors log.

Correct git_get_hash_by_path and parse_commit_text (and, in turn,
parse_commit) to return undef if object does not exist.  Check in
git_tag if requested tag exists.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-13 12:12:30 -07:00
Jakub Narebski
2206537c07 gitweb: Test if $from_id and $to_id are defined before comparison
Get rid of "Use of uninitialized value in string eq at
gitweb/gitweb.perl line 2320" warning caused by the fact that "empty"
patches, consisting only of extended git diff header and with patch
body empty, such as patch for pure rename, does not have "index" line
in extended diff header.  For such patches $from_id and $to_id, filled
from parsing extended diff header, are undefined.  But such patches
cannot be continuation patches.

Test if $from_id and $to_id are defined before comparing them with
$diffinfo.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:19:08 -07:00
Petr Baudis
63fcbe00a6 gitweb: Do not use absolute font sizes
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>
2007-05-10 14:13:29 -07:00
Gerrit Pape
7f9778b19b gitweb: choose appropriate view for file type if a= parameter missing
gitweb URLs use the a= parameter for the view to use on the given path, such
as "blob" or "tree".  Currently, if a gitweb URL omits the a= parameter,
gitweb just shows the top-level repository summary, regardless of the path
given.  gitweb could instead choose an appropriate view based on the file
type: blob for blobs (files), tree for trees (directories), and summary if
no path given (the URL included no f= parameter, or an empty f= parameter).

Apart from making gitweb more robust and supporting URL editing more easily,
this change would aid the creation of shortcuts to git repositories using
simple substitution, such as:
http://example.org/git/?p=path/to/repo.git;hb=HEAD;f=%s

With this patch, if given the hash through the h= parameter, or the hash
base (hb=) and a filename (f=), gitweb uses cat-file -t to automatically set
the a= parameter.

This feature was requested by Josh Triplett through
 http://bugs.debian.org/410465

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 00:42:43 -07:00
Jakub Narebski
208ecb2e86 gitweb: Show combined diff for merge commits in 'commit' view
When commit shown is a merge commit (has more than one parent),
display combined difftree output (result of git-diff-tree -c).
Earlier (since commit 549ab4a307)
difftree output (against first parent) was not printed for merges.

Examples of non-trivial merges:
  5bac4a6719 (includes rename)
  addafaf92e (five parents)
  95f97567c1887d77f3a46b42d8622c76414d964d (evil merge)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:19 -07:00
Jakub Narebski
fb1dde4a90 gitweb: Show combined diff for merge commits in 'commitdiff' view
When 'commitdiff' action is requested without 'hp' (hash parent)
parameter, and commit given by 'h' (hash) parameter is merge commit,
show merge as combined diff.

Earlier for merge commits without 'hp' parameter diff to first parent
was shown.

Note that in compact combined (--cc) format 'uninteresting' hunks
omission mechanism can make that there is no patch corresponding to
line in raw format (difftree) output. That is why (at least for now)
we use --combined and not --cc format for showing commitdiff for merge
commits.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:19 -07:00
Jakub Narebski
493e01db51 gitweb: Make it possible to use pre-parsed info in git_difftree_body
Make it possible to use pre-parsed, or generated by hand, difftree
info in git_difftree_body, similarly to how was and is it done in
git_patchset_body.

Use just introduced feature in git_commitdiff to parse difftree info
(raw diff output) only once: difftree info is now parsed in
git_commitdiff directly, and parsed information is passed to both
git_difftree_body and git_patchset_body. (Till now only git_blobdiff
made use of git_patchset_body ability to use pre-parsed or hand
generated info.) Additionally this makes rename info for combined diff
with renames (or copies) calculated only once in git_difftree_body;
the $difftree is modified and git_patchset_body makes use of added
info.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:19 -07:00
Jakub Narebski
e72c0eaf9b gitweb: Add combined diff support to git_patchset_body
Calling convention for combined diff similar to the one for
git_difftree_body subroutine: difftree info (first parameter) must be
result of calling git-diff-tree with -c/--cc option, and all parents
of a commit must be passed as last parameters. See also description in
  "gitweb: Add combined diff support to git_difftree_body"

This ability is not used yet.

Generating "src" file name for renames in combined diff was separated
into fill_from_file_info subroutine; git_difftree_body was modified to
use it. Currently git_difftree_body and git_patchset_body fills this
info separately.

The from-file line in two-line from-file/to-file header is not
hyperlinked: there can be more than one "from"/"src" file. This
differs from HTML output of ordinary (not combined) diff.

format_diff_line subroutine needs extra $from/$to parameters to format
combined diff patch line correctly.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:19 -07:00
Jakub Narebski
ed224deac9 gitweb: Add combined diff support to git_difftree_body
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>
2007-05-07 18:20:18 -07:00
Jakub Narebski
78bc403aaf gitweb: Add parsing of raw combined diff format to parse_difftree_raw_line
Add parsing line of raw combined diff ("git diff-tree -c/-cc" output)
as described in section "diff format for merges" in diff-format.txt
to parse_difftree_raw_line subroutine.

Returned hash (or hashref) has for combined diff 'nparents' key which
holds number of parents in a merge. At keys 'from_mode' and 'from_id'
there are arrayrefs holding modes and ids, respectively. There is no
'similarity' value, and there is only 'to_file' value and no
'from_file' value.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:18 -07:00
Junio C Hamano
9aae177a4a Merge branch 'maint'
* maint:
  gitweb: use decode_utf8 directly
  posix compatibility for t4200
  Document 'opendiff' value in config.txt and git-mergetool.txt
  Allow PERL_PATH="/usr/bin/env perl"
  Make xstrndup common
  diff.c: fix "size cache" handling.
  http-fetch: Disable use of curl multi support for libcurl < 7.16.
2007-05-03 23:26:54 -07:00
Ismail Dönmez
e3ad95a8be gitweb: use decode_utf8 directly
Using decode() tries to decode data that is already UTF-8 and
borks, but decode_utf8 from Encode.pm has a built-in safety
against that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-03 23:22:12 -07:00
Martin Koegler
4280cde95f gitweb: Show "no difference" message for empty diff
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>
2007-04-22 22:49:25 -07:00
Frank Lichtenheld
b06dcf8cb8 gitweb: Allow configuring the default projects order and add order 'none'
Introduce new configuration variable $default_projects_order
that can be used to specify the default order of projects on
the index page if no 'o' parameter is given.

Allow a new value 'none' for order that will cause the projects
to be in the order we learned about them. In case of reading the
list of projects from a file, this should be the order as they are
listed in the file. In case of reading the list of projects from
a directory this will probably give random results depending on the
filesystem in use.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 17:24:35 -07:00
Frank Lichtenheld
c2b8b13494 gitweb: Allow forks with project list file
Make it possible to use the forks feature even when
reading the list of projects from a file, by creating
a list of known prefixes as we go. Forks have to be
listed after the main project in order to be recognised
as such.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 17:24:35 -07:00
Junio C Hamano
77e6f5bc10 Merge branch 'maint'
* maint:
  Fix lseek(2) calls with args 2 and 3 swapped
  Honor -p<n> when applying git diffs
  Fix dependency of common-cmds.h
  Fix renaming branch without config file
  DESTDIR support for git/contrib/emacs
  gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches
  Document --left-right option to rev-list.
  Revert "builtin-archive: use RUN_SETUP"
  rename contrib/hooks/post-receieve-email to contrib/hooks/post-receive-email.
  rerere: make sorting really stable.
  Fix t4200-rerere for white-space from "wc -l"
2007-04-05 16:34:51 -07:00
Jakub Narebski
957d6ea78f gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches
git_patchset_body needs patch generated with --full-index option to
detect split patches, meaning two patches which corresponds to single
difftree (raw diff) entry.  An example of such situation is changing
type (mode) of a file, e.g. from plain file to symbolic link.

Add, in git_blobdiff, --full-index option to patch generating git diff
invocation, for the 'html' format output ("blobdiff" view).

"blobdiff_plain" still uses shortened sha1 in the extended git diff
header "index <hash>..<hash>[ <mode>]" line.

Noticed-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>
2007-04-05 14:14:55 -07:00
Jakub Narebski
3be8e720d9 gitweb: Quote hash keys, and do not use barewords keys
Ensure that in all references to an element of a hash, the
key is singlequoted, instead of using bareword: use $hash{'key'}
instead of $hash{key}

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 02:37:35 -07:00
Jakub Narebski
a23f0a73d1 gitweb: Whitespace cleanup - tabs are for indent, spaces are for align (3)
Code should be look the same way, regardless of tab size.
Use tabs for indent, but spaces for align.

Indent continued part of command spanning multiple lines, but only once.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 02:37:34 -07:00
Jakub Narebski
5ae917acdf gitweb: Support comparing blobs (files) with different names
Fix the bug that caused "blobdiff" view called with new style URI
for a rename with change diff to be show as new (added) file diff.

New style URI for "blobdiff" for rename means with $hash_base ('hb') and
$hash_parent_base ('hpb') paramaters denoting tree-ish (usually commit)
of a blobs being compared, together with both $file_name ('f') and
$file_parent ('fp') parameters.

It is done by adding $file_parent ('fp') to the path limiter, meaning
that diff command becomes:

	git diff-tree [options] hpb hb -- fp f

Other option would be finding hash of a blob using git_get_hash_by_path
subroutine and comparing blobs using git-diff, or using extended SHA-1
syntax and compare blobs using git-diff:

	git diff [options] hpb:fp hp:f

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 00:47:48 -07:00
Jakub Narebski
f73bbb2d0c gitweb: Cleanup and uniquify die_error calls
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-27 12:58:23 -07:00
Jakub Narebski
52c813f22f gitweb: Add example of config file and how to generate projects list to gitweb/INSTALL
Add simple example of config file (turning on and allowing override of
a few %features). Also example config file and script to generate list
of projects in a format that can be used as GITWEB_LIST / $projects_list.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-25 22:22:33 -07:00
Jakub Narebski
cd67c8e0bc gitweb: Add some installation notes in gitweb/INSTALL
Add some installation and configuration notes for gitweb in
gitweb/INSTALL. Make use of filling gitweb configuration by
Makefile.

It does not cover (yet?) all the configuration variables and
options.

Some of contents duplicates information in gitweb/README file
(it is referred from gitweb/INSTALL).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:26:33 -07:00
Jakub Narebski
4ae89b7625 gitweb: Fix not marking signoff lines in "log" view
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>
2007-03-24 22:25:55 -07:00
Jakub Narebski
346d5e1835 gitweb: Don't escape attributes in CGI.pm HTML methods
There is no need to escape HTML tag's attributes in CGI.pm
HTML methods (like CGI::a()), because CGI.pm does attribute
escaping automatically.

  $cgi->a({ ... -attribute => atribute_value }, tag_contents)

is translated to

  <a ... attribute="attribute_value">tag_contents</a>

The rules for escaping attribute values (which are string contents) are
different. For example you have to take care about escaping embedded '"'
and "'" characters; CGI::a() does that for us automatically.

CGI::a() does not HTML escape tag_contents; we would need to write

  <a href="URL">some <b>bold</b> text</a>

for example. So we use esc_html (or esc_path) to escape tag_contents
as needed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:25:47 -07:00
Li Yang
290b1467a3 gitweb: Change to use explicitly function call cgi->escapHTML()
Change to use explicitly function call cgi->escapHTML().
This fix the problem on some systems that escapeHTML() is not
functioning, as default CGI is not setting 'escape' parameter.

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:25:40 -07:00
Jakub Narebski
f9308a182e gitweb: Fix "next" link in commit view
Fix copy'n'paste error in commit c9d193df which caused that "next"
link for merge commits in "commit" view
  (merge: _commit_ _commit_ ...)
was to "commitdiff" view instead of being to "commit" view.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-23 14:54:52 -07:00
Junio C Hamano
c8f80d4dc8 gitweb: fix mismatched parenthesis
An earlier commit 04179418 broke gitweb.  Badly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-06 01:09:32 -08:00
Yasushi SHOJI
041794188f gitweb: Convert project name to UTF-8
If the repository directory name is in non-ascii, $project needs to be
converted from perl internal to utf-8 because it will be used as
title, page path, and snapshot filename.

use to_utf8() to do the conversion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Pavel Roskin
3dff5379bf Assorted typo fixes
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 21:49:54 -08:00
Tom Prince
e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Jakub Narebski
0bdb28c9cc gitweb: Fix git_patchset_body not closing <div class="patch">
Fix case when git_patchset_body didn't close <div class="patch">,
for patchsets with last patch empty.

This patch also removes some commented out code in git_patchset_body.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:23:39 -08:00
Jakub Narebski
3faa541fa9 gitweb: Remove superfluous "|" in "commit" view
Remove superfluous trailing "|" separator from difftree part of "commit"
view for new files (created in given commit).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:06:45 -08:00
Jakub Narebski
13e86efbea gitweb: Fix split patches output (e.g. file to symlink)
Do not replace /dev/null in two-line from-file/to-file diff header for
split patches ("split" patch mean more than one patch per one
diff-tree raw line) by a/file or b/file link.

Split patches differ from pair of deletion/creation patch in git diff
header: both a/file and b/file are hyperlinks, in all patches in a
split.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:53:08 -08:00
Jakub Narebski
ac8b0cd1cd Revert "gitweb: There can be empty patches (in git_patchset_body)"
This reverts commit 1ebb948f65,
as that patch quieted warning but was not proper solution.
The previous commit was.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:55 -08:00
Jakub Narebski
66399eff86 gitweb: Fix errors in git_patchset_body for empty patches
We now do not skip over empty patches in git_patchset_body (where
empty means that they consist only of git diff header, and of extended
diff header, for example "pure rename" patch).  This means that after
extended diff header there can be next patch (i.e. /^diff /) or end of
patchset, and not necessary patch body (i.e. /^--- /).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:54 -08:00
Jakub Narebski
2e1951f6ed gitweb: Fix error in "rename to"/"copy to" git diff header output
Fix error in git_patchset_body subroutine, which caused "rename to"/"copy
to" line in extended diff header to be displayed incorrectly.

While at it, fix align.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:52 -08:00
Jakub Narebski
62e4f26f3d gitweb: Fix error in git_patchest_body for file creation/deletion patch
$from_id, $to_id variables should be local per PATCH.

Fix error in git_patchset_body for file creation (deletion) patches,
where instead of /dev/null as from-file (to-file) diff header line, it
had link to previous file with current file name.  This error occured
only if there was another patch before file creation (deletion) patch.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:49 -08:00
Luben Tuikov
244a70e608 Blame "linenr" link jumps to previous state at "orig_lineno"
Blame currently displays the commit id which introduced a
block of one or more lines, the line numbers wrt the current
listing of the file and the file's line contents.

The commit id displayed is hyperlinked to the commit.

Currently the linenr links are hyperlinked to the same
commit id displayed to the left, which is _no_ different
than the block of lines displayed, since it is the _same
commit_ that is hyperlinked.  And thus clicking on it leads
to the same state of the file for that chunk of
lines. I.e. data mining is not currently possible with
gitweb given a chunk of lines introduced by a commit.

This patch makes such data mining possible.

The line numbers are now hyperlinked to the parent of the
commit id of the block of lines.  Furthermore they are
linked to the line where that block was introduced.

Thus clicking on a linenr link will show you the file's
line(s) state prior to the commit id you were viewing.

So clicking continually on a linenr link shows you how this
line and its line number changed over time, leading to the
initial commit where it was first introduced.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-04 23:20:43 -08:00
Jakub Narebski
27dd1a83cb gitweb: Fix "Use of uninitialized value" warning in git_tags_body
Fix "Use of uninitialized value" warning in git_tags_body generated
for lightweight tags of tree and blob object; those don't have age
($tag{'age'}) defined.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-04 23:19:09 -08:00
Robert Fitzsimons
d222984e36 gitweb: Fix shortlog only showing HEAD revision.
My change in 190d7fdcf3 had a small bug
found by Michael Krufky which caused the passed in hash value to be
ignored, so shortlog would only show the HEAD revision.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-03 12:48:39 -08:00
Jakub Narebski
1ebb948f65 gitweb: There can be empty patches (in git_patchset_body)
We now do not skip over empty patches in git_patchset_body
(where empty means that they consist only of git diff header,
and of extended diff header), so uncomment branch of code dealing
with empty patches (patches which do not have even two-line
from/to header)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-03 12:19:20 -08:00
Jakub Narebski
6e72cf43a7 gitweb: Fix bug in git_difftree_body (was '!=' instead of 'ne')
Fix bug in git_difftree_body subroutine; it was used '!=' comparison
operator for strings (file type) instead of correct 'ne'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-03 12:19:20 -08:00
Jakub Narebski
956259ee74 gitweb: Fix error in git_project_index subroutine
Instead of "$projectroot/$pr->{'path'}" to get the path to project
GIT_DIR, it was used "$projectroot/$project" which is valid only
for actions where project parameter is set, and 'project_index' is not
one of them.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-03 08:14:46 -08:00
Jakub Narebski
b1f5f64fc8 gitweb: Precompile CGI routines for mod_perl
Following advice from CGI(3pm) man page, precompile all CGI routines
for mod_perl, in the BEGIN block.

  If you want to compile without importing use the compile() method
  instead:

    use CGI();
    CGI->compile();

  This is particularly useful in a mod_perl environment, in which you
  might want to precompile all CGI routines in a startup script, and then
  import the functions individually in each mod_perl script.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 00:57:31 -08:00
Jakub Narebski
45c9a7583c gitweb: Add mod_perl version string to "generator" meta header
Add mod_perl version string (the value of $ENV{'MOD_PERL'} if it is
set) to "generator" meta header.

The purpose of this is to identify version of gitweb, now that
codepath may differ for gitweb run as CGI script, run under
mod_perl 1.0 and run under mod_perl 2.0.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 00:57:11 -08:00
Robert Fitzsimons
ccdfdea08d gitweb: Re-enable rev-list --parents for parse_commit.
Re-enable rev-list --parents for parse_commit which was removed in
(208b2dff95).  rev-list --parents is not
just used to return the parent headers in the commit object, it
includes any grafts which are vaild for the commit.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-27 14:21:50 -08:00
Robert Fitzsimons
f47efbb7ab gitweb: Use rev-list --skip option.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:44 -08:00
Robert Fitzsimons
a8b983bfea gitweb: Change history action to use parse_commits.
Also added missing accesskey.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:44 -08:00
Robert Fitzsimons
b6093a5c02 gitweb: Change atom, rss actions to use parse_commits.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:44 -08:00
Robert Fitzsimons
5ad66088d1 gitweb: Change header search action to use parse_commits.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:43 -08:00
Robert Fitzsimons
719dad28c5 gitweb: Change log action to use parse_commits.
Also add missing next link to bottom of page.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:43 -08:00
Robert Fitzsimons
190d7fdcf3 gitweb: Change summary, shortlog actions to use parse_commits.
Also added missing accesskey.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:43 -08:00
Robert Fitzsimons
208b2dff95 gitweb: We do longer need the --parents flag in rev-list.
We only want to know the direct parents of a given commit object,
these parents are available in the --header output of rev-list.  If
--parents is supplied with --full-history the output includes merge
commits that aren't relevant.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:43 -08:00
Robert Fitzsimons
756bbf548d gitweb: Add parse_commits, used to bulk load commit objects.
Add a new method parse_commits which is able to parse multiple commit
objects at once.  Reworked parse_commit to share the commit object
parsing logic.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-25 10:40:43 -08:00
Robert Fitzsimons
8dbc0fcef4 gitweb: Paginate commit/author/committer search output
Paginate commit/author/committer search output to only show 100 commits
at a time, added appropriate nav links.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-23 09:30:36 -08:00
Robert Fitzsimons
6be935115b gitweb: Allow search to be disabled from the config file.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:42 -08:00
Robert Fitzsimons
9d032c7250 gitweb: Require a minimum of two character for the search text.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:41 -08:00
Robert Fitzsimons
8e574fb542 gitweb: Use rev-list pattern search options.
Use rev-list pattern search options instead of hand coded perl.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:40 -08:00
Robert Fitzsimons
a979d1289b gitweb: optimize git_summary.
We don't need to call git_get_head_hash at all just pass in "HEAD" and
use the return id field.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:18 -08:00
Robert Fitzsimons
3fcf06be5d gitweb: optimize git_shortlog_body.
Don't call gitweb_have_snapshot from within the loop.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:16 -08:00
Robert Fitzsimons
0ff5ec70c7 gitweb: optimize git_get_last_activity.
Only return one line of output and we don't need the refname value.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:15 -08:00
Robert Fitzsimons
aaca9675a4 gitweb: Add missing show '...' links change.
Part of the patch for "gitweb: Show '...' links in "summary" view only
if there are more items" (313ce8cee6) is
missing.  Add it back in.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:18:13 -08:00
Robert Fitzsimons
313ce8cee6 gitweb: Show '...' links in "summary" view only if there are more items
Show "..." links in "summary" view to shortlog, heads (if there are
any), and tags (if there are any) only if there are more items to show
than shown already.

This means that "..." link is shown below shortened shortlog if there
are more than 16 commits, "..." link below shortened heads list if
there are more than 16 heads refs (16 branches), "..." link below
shortened tags list if there are more than 16 tags.

Modified patch from Jakub to to apply cleanly to master, also preform
the same "..." link logic to the forks list.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-19 22:49:59 -08:00
Jakub Narebski
c9d193dffb gitweb: Add "next" link to commit view
Add a kind of "next" view in the bottom part of navigation bar for
"commit" view, similar to what was added for "commitdiff" view in
commit 151602df00
  'gitweb: Add "next" link to commitdiff view'

For "commit" view for single parent commit:
  (parent: _commit_)
For "commit" view for merge (multi-parent) commit:
  (merge: _commit_ _commit_ ...)
For "commit" view for root (parentless) commit
  (initial)
where _link_ denotes hyperlink.  SHA1 of commit is shortened
to 7 characters on display.

While at it, remove leftovers from commit cae1862a by Petr Baudis:
  'gitweb: More per-view navigation bar links'
namely the "blame" link if there exist $file_name and commit has a
parent; it was added in git_commit probably by mistake.  The rest
of what mentioned commit added for git_commit was removed in
commit 6e0e92fda8 by Luben Tuikov:
  'gitweb: Do not print "log" and "shortlog" redundantly in commit view'
(which should have probably removed also this "blame" link removed now).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 12:03:22 -08:00
Jakub Narebski
5fce278ef3 gitweb: Add title attribute to ref marker with full ref name
Add title attribute, which will be shown as popup on mouseover in
graphical web browsers, with full name of ref, including part (type)
removed from the name of ref itself. This is useful to see that this
strange ref is StGIT ref, or it is remote branch, or it is lightweigh
tag (with branch-like name).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 12:03:22 -08:00
Jakub Narebski
549ab4a307 gitweb: Do not show difftree for merges in "commit" view
Do not show difftree against first parent for merges (commits with
more than one parent) in "commit" view, because it usually is
misleading.  git-show and git-whatchanged doesn't show diff for merges
either.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 12:03:22 -08:00
Jakub Narebski
bfe2191f79 gitweb: SHA-1 in commit log message links to "object" view
Instead of checking if explicit SHA-1 in commit log message is sha1 of
commit and making link to "commit" view, make [fragment of] explicit
SHA-1 in commit log message link to "object" view.  While at it allow
to hyperlink also shortened SHA-1, from 8 characters up to full SHA-1,
instead of requiring full 40 characters of SHA-1.

This makes the following changes:

 * SHA-1 of objects which no longer exists, for example in commit
   cherry-picked from no longer existing temporary branch, or revert
   of commit in rebased branch, are no longer marked as such by not
   being made into hyperlink (and not having default hyperlink view:
   being underlined among others).  On the other hand it makes gitweb
   to not write error messages when object is not found to web serwer
   log; it also moves cost of getting type and SHA-1 validation to
   when link is clicked, and not only viewed.

 * SHA-1 of other objects: blobs, trees, tags are also hyperlinked
   and lead to appropriate view (although in the case of tags it is
   more natural to just use tag name).

 * You can put shortened SHA-1 of commit in the commit message, and it
   would be hyperlinked; it would be checked on clicking if abbrev is
   unique.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:55:26 -08:00
Jakub Narebski
3bf9d57051 gitweb: Hyperlink target of symbolic link in "tree" view (if possible)
Make symbolic link target in "tree" view into hyperlink to generic
"object" view (as we don't know if the link target is file (blob) or
directory (tree), and if it exist at all).

Target of link is made into hyperlink when:
 * hash_base is provided (otherwise we cannot find hash
   of link target)
 * link is relative
 * in no place link goes out of root tree (top dir)

Full path of symlink target from the root dir is provided in the title
attribute of hyperlink.

Currently symbolic link name uses ordinary file style (hidden
hyperlink), while the hyperlink to symlink target uses default
hyperlink style, so it is underlined while link target which is not
made into hyperlink is not underlined.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:55:25 -08:00
Jakub Narebski
ca94601c8f gitweb: Add generic git_object subroutine to display object of any type
Add generic "object" view implemented in git_object subroutine, which is
used to display object of any type; to be more exact it redirects to the
view of correct type: "blob", "tree", "commit" or "tag".  To identify object
you have to provide either hash (identifier of an object), or (in the case of
tree and blob objects) hash of commit object (hash_base) and path (file_name).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:55:23 -08:00
Jakub Narebski
e33fba4c5a gitweb: Show target of symbolic link in "tree" view
In "tree" view (git_print_tree_entry subroutine), for entries which are
symbolic links, add " -> link_target" after file name (a la "ls -l").

Link target is _not_ hyperlinked.

While at it, correct whitespaces (tabs are for aling, spaces are for indent)
in modified git_print_tree_entry subroutine.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:55:22 -08:00
Jakub Narebski
9aa1757382 gitweb: Don't use Content-Encoding: header in git_snapshot
Do not use Content-Encoding: HTTP header in git_snapshot, using
instead type according to the snapshot type (compression type).
Some of web browser take Content-Encoding: to be _transparent_
also for downloading, and store decompressed file (with incorrect
compression suffix) on download.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:55:20 -08:00
Uwe Zeisberger
bbee1d971d Fix documentation copy&paste typo
This was introduced in 45a3b12cfd

Signed-off-by: Uwe Kleine-K,AC6(Bnig <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-08 10:51:12 -08:00
Jakub Narebski
5a4cf3346d gitweb: Allow PNG, GIF, JPEG images to be displayed in "blob" view
Allow images in one of web formats (PNG, GIF, JPEG) - actually files
with mimetype of image/png, image/git, image/jpeg - to be displayed in
"blob" view using <img /> element, instead of using "blob_plain" view
for them, like for all other files except also text/* mimetype files.

This makes possible to easily go to file history, to HEAD version of
the file, to appropriate commit etc; all of those are not available
in "blob_plain" (raw) view.

Only text files can have "blame" view link in the formats part of
navbar.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-06 11:11:58 -08:00