Commit Graph

237 Commits

Author SHA1 Message Date
Luben Tuikov
6e0e92fda8 gitweb: Do not print "log" and "shortlog" redundantly in commit view
Do not print "log" and "shortlog" redundantly in commit
view.  This is passed into the $extra argument of
git_print_page_nav from git_commit, but git_print_page_nav
prints "log" and "shortlog" already with the same head.

Noticed by Junio.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-05 13:05:00 -07:00
Junio C Hamano
9ccb64c8e0 tar-tree deprecation: we eat our own dog food.
It is silly to keep using git-tar-tree in dist target when the
command gives a big deprecation warning when called.  Instead,
use "git-archive --format=tar" which we recommend to our users.

Update gitweb's snapshot feature to use git-archive for the same
reason.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-05 02:26:12 -07:00
Alan Chandler
604cb211a9 Update the gitweb/README file to include setting the GITWEB_CONFIG environment
Signed-off-by: Alan Chandler <alan@chandlerfamily.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 23:58:38 -07:00
Martin Waitz
128eead198 gitweb: document webserver configuration for common gitweb/repo URLs.
Add a small apache configuration which shows how to use apache
to put gitweb and GIT repositories at the same URL.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 01:09:56 -07:00
Luben Tuikov
e70866f53a gitweb: Escape ESCAPE (\e) character
Take a look at commit 20a3847d8a
using gitweb before this patch.  This patch fixes this.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 01:04:41 -07:00
Junio C Hamano
99692dc213 Merge branch 'lt/web'
* lt/web:
  gitweb: tree view: hash_base and hash are now context sensitive
  gitweb: History: blob and tree are first, then commitdiff, etc
  gitweb: Remove redundant "commit" from history
  gitweb: Don't use quotemeta on internally generated strings
  gitweb: Add snapshot to shortlog
  gitweb: Factor out gitweb_have_snapshot()
  gitweb: Remove redundant "commit" link from shortlog
  gitweb: "alternate" starts with shade (i.e. 1)
  gitweb: Add history and blame to git_difftree_body()
  gitweb: Remove excessively redundant entries from git_difftree_body
  Revert "gitweb: extend blame to show links to diff and previous"
  gitweb: Quote filename in HTTP Content-Disposition: header
  gitweb: Add git_url subroutine, and use it to quote full URLs
  gitweb: Split validate_input into validate_pathname and validate_refname
  gitweb: Use "return" instead of "return undef" for some subs
  gitweb: Strip trailing slashes from $path in git_get_hash_by_path
  gitweb: extend blame to show links to diff and previous
  gitweb: Remove redundant "tree" link
  gitweb: tree view: eliminate redundant "blob"
2006-09-30 21:27:51 -07:00
Luben Tuikov
6f7ea5fb33 gitweb: tree view: hash_base and hash are now context sensitive
In tree view, by default, hash_base is HEAD and hash is the
entry equivalent.  Else the user had selected a hash_base or
hash, say by clicking on a revision or commit, in which case
those values are used.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-30 00:23:23 -07:00
Luben Tuikov
6d81c5a2ea gitweb: History: blob and tree are first, then commitdiff, etc
Reorder link display in history to be consistent with other
list displays: log, shortlog, etc.  We now display:

	blob | commitdiff
	blob | commitdiff | diff_to_current

and

	tree | commitdiff

Instead of the old history format where "blob" and "tree"
are between "commitdiff" and "diff_to_current" if present/
applicable.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 19:04:01 -07:00
Luben Tuikov
e46b3c027e gitweb: Remove redundant "commit" from history
Remove redundant "commit" from history -- it can be had
by clicking on the title of the commit.  This commit
makes visualization consistent with shortlog, log, etc.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 19:03:28 -07:00
Luben Tuikov
a2a3bf7b2b gitweb: Don't use quotemeta on internally generated strings
Do not use quotemeta on internally generated strings
such as filenames of snapshot, blobs, etc.
quotemeta quotes any characters not matching /A-Za-z_0-9/.
Which means that we get strings like this:

before: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
after:  linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz

This patch fixes this.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 18:58:16 -07:00
Luben Tuikov
ba6ef81017 gitweb: Add snapshot to shortlog
Add snapshot to each commit-row of shortlog.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 18:57:00 -07:00
Luben Tuikov
de9272f4bd gitweb: Factor out gitweb_have_snapshot()
Create gitweb_have_snapshot() which returns true
of snapshot is available and enabled, else false.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 18:56:35 -07:00
Luben Tuikov
d1d866e9b8 gitweb: Remove redundant "commit" link from shortlog
Remove the redundant "commit" link from shortlog.
It can be had by simply clicking on the entry title
of the row.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 18:52:36 -07:00
Luben Tuikov
6dd36acd32 gitweb: "alternate" starts with shade (i.e. 1)
When displaying a list of rows (difftree, shortlog, etc),
the first entry is now printed shaded, i.e. alternate is
initialized to 1, as opposed to non-shaded (alternate
initialized to 0).

This solves the problem when there is only one row to
display -- it is displayed shaded to visually indicate that
it is "active", part of a "list", etc.

(Compare this to the trivial case of more than one entry,
where the rows have alternating shade, thus suggesting
being part of a "list" of "active" entries, etc.)

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 18:52:26 -07:00
Luben Tuikov
eb51ec9c05 gitweb: Add history and blame to git_difftree_body()
Add blame and history to Deleted files.
Add blame and history to Modified or Type changed files.
Add blame and history to Renamed or Copied files.

This allows us to do
	blame->commit->blame->commit->blame->...
instead of
	blame->commit->file->blame->commit->file->blame->...
which is longer and easier to get wrong.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 21:56:59 -07:00
Luben Tuikov
499faeda1b gitweb: Remove excessively redundant entries from git_difftree_body
1) All entries on the left are blobs and clicking on them
leads to blobs.  No more diff or blob depending on what
happened (modified or mode changed) to the file -- this goes
to the right, in the "link" column.

2) Remove redundant "blob" from the link column on the right.
This can now be had by clicking on the entry itself.

This reduces and simplifies the code.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 21:30:01 -07:00
Luben Tuikov
709f898dae Revert "gitweb: extend blame to show links to diff and previous"
This concept is very fine, but it makes blame slow
across renames and across branches, so revert it.
There is a better way to do this.

This reverts commit 03d06a8e26f4fbd37800d1e1125c6ecf4c104466.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 21:29:10 -07:00
Jakub Narebski
ab41dfbfd4 gitweb: Quote filename in HTTP Content-Disposition: header
Finish work started by commit a2f3db2 (although not documented
in commit message) of quoting using quotemeta the filename in
HTTP -content_disposition header.

Just in case filename contains end of line character.

Also use consistent coding style to compute -content_disposition
parameter.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:41:36 -07:00
Jakub Narebski
f93bff8d45 gitweb: Add git_url subroutine, and use it to quote full URLs
Add git_url subroutine, which does what git_param did before commit
a2f3db2f5d, and is used to quote full
URLs, currently only $home_link.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:41:35 -07:00
Jakub Narebski
24d0693a68 gitweb: Split validate_input into validate_pathname and validate_refname
Split validate_input subroutine into validate_pathname which is used
for $project, $file_name and $file_parent parameters, and
validate_refname which is used for $hash, $hash_base, $hash_parent and
$hash_parent_base parameters.  Reintroduce validation of $file_name
and $file_parent parameters, removed in a2f3db2f

validate_pathname in addition to what validate_input did checks also
for doubled slashes and NUL character. It does not check if input is
textual hash, and does not check if all characters are from the
following set: [a-zA-Z0-9_\x80-\xff\ \t\.\/\-\+\#\~\%].

validate_refname first check if the input is textual hash, then checks
if it is valid pathname, then checks for invalid characters (according
to git-check-ref-format manpage). It does not check if all charactes
are from the [a-zA-Z0-9_\x80-\xff\ \t\.\/\-\+\#\~\%] set.

We do not have to validate pathnames we got from git.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:41:35 -07:00
Jakub Narebski
dd1ad5f167 gitweb: Use "return" instead of "return undef" for some subs
Use "return" instead of "return undef" when subroutine can return, or
always return, non-scalar (list) value.

Other places are left as is.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:41:35 -07:00
Jakub Narebski
4b02f48372 gitweb: Strip trailing slashes from $path in git_get_hash_by_path
It also removes unused local variable $tree

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:41:35 -07:00
Luben Tuikov
65910395c0 gitweb: extend blame to show links to diff and previous
git_blame2() now has two more columns, "Prev" and "Diff",
before the "Commit" column, as follows:

Prev	Diff	Commit	Line	Data
SHA     Diff    SHA        N    ...
...

The "Prev" column shows the SHA of the parent commit,
between which this line changed.  Clicking on it shows the
blame of the file as of the parent commit, for that line.

So clicking repeatedly on "Prev" would show you the blame
of that file, from the point of view of the changes
of that particular line whose "Prev" you're clicking on.

The "Diff" column shows "Diff" which is a link to blobdiff
between "Prev" and "Commit" commits _for that line_.

So clicking on "Diff" would show you the blobdiff (HTML)
between the parent commit and this commit which changed
that particular line.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:10:17 -07:00
Yasushi SHOJI
4a0641b7cf gitweb: Decode long title for link tooltips
This is a simple one liner to decode long title string in perl's
internal form to utf-8 for link tooltips.

This is not crucial if the commit message is all in ASCII, however, if
you decide to use other encoding, such as UTF-8, tooltips ain't
readable any more.

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:08:51 -07:00
Luben Tuikov
0fa105e7f1 gitweb: Remove redundant "tree" link
In "tree" view, remove redundant "tree" link in the tree
listing.  It is identical to simply clicking on the tree
entry itself.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 23:47:10 -07:00
Luben Tuikov
4de741b3e1 gitweb: tree view: eliminate redundant "blob"
Binary and non-binary blobs:

The "list" table element of tree view is identical
to the "blob" link part of the link table element.
I.e. clicking on "blob" is identical to clicking on
the entry itself.

Thus, eliminate "blob" from being shown -- the user
can get identical result by simply clicking on the
entry itself.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-25 23:09:55 -07:00
Petr Baudis
8391548e5e gitweb: fix over-eager application of esc_html().
Contents of %diffinfo hash should be quoted upon output but kept
unquoted internally.  Later users of this hash expect filenames
to be filenames, not HTML gibberish.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:33:09 -07:00
Petr Baudis
a2f3db2f5d gitweb: Consolidate escaping/validation of query string
Consider:

	http://repo.or.cz/?p=glibc-cvs.git;a=tree;h=2609cb0411389325f4ee2854cc7159756eb0671e;hb=2609cb0411389325f4ee2854cc7159756eb0671e

(click on the funny =__ify file)

We ought to handle anything in filenames and I actually see no reason why
we don't, modulo very little missing escaping that this patch hopefully
also fixes.

I have also made esc_param() escape [?=&;]. Not escaping [&;] was downright
buggy and [?=] just feels better escaped. ;-) YMMV.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-23 23:53:18 -07:00
Petr Baudis
5c7d2cf3d6 Fix snapshot link in tree view
It would just give HEAD snapshot instead of one of the particular tree.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 16:59:22 -07:00
Petr Baudis
74d6166751 gitweb: Fix @git_base_url_list usage
As it is now, that array was never used because the customurl accessor was
broken and ''unless @url_list'' never happenned.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 16:59:04 -07:00
Petr Baudis
d726720743 gitweb: Fix tree link associated with each commit log entry.
The link forgot to have hb parameter and the resulting tree view
failed to show the navbar for that commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 16:58:51 -07:00
Petr Baudis
26d0a976e8 Make path in tree view look nicer
Based on talk on the IRC with Junio some evenings ago, I've updated the
path showing in tree view to look better and sent updated patches
privately, but it seems the old version ended up being used, so here's
the new one again.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 16:49:36 -07:00
Petr Baudis
f35274dad8 gitweb: Relabel "head" as "HEAD"
"head" is a reference in refs/heads/, while those labels mean HEAD,
the latest revision of the default branch.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 21:21:04 -07:00
Petr Baudis
35329cc1cc gitweb: Rename "plain" labels to "raw"
I don't have much preference either way and as far as I'm concerned, it may
go the other way as well. Consistency is what is important.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 21:18:26 -07:00
Petr Baudis
6ef4cb2e8d gitweb: Link to associated tree from a particular log item in full log view
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 21:01:28 -07:00
Petr Baudis
1d62be25ed gitweb: Link to latest tree from the head line in heads list
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 21:00:51 -07:00
Petr Baudis
35749ae566 gitweb: Link to tree instead of snapshot in shortlog
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 20:58:50 -07:00
Petr Baudis
cae1862a3b gitweb: More per-view navigation bar links
Navigation bars in various views were empty or missed important items that
should have been there, e.g. getting a snapshot in tree view or log of
ancestry in commit view...

This feeble patch attempts to consolidate that.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 20:57:43 -07:00
Petr Baudis
609ff267fb gitweb: Link (HEAD) tree for each project from projects list
Current projects list is oriented on easily getting "what's new"
information. But when already using gitweb as an interface to something,
I personally find myself to _much_ more frequently wanting to rather
see "what's in" (or "what's new in") and it's quite annoying to have to
go through the summary page (which is also rather expensive to generate)
just to get there.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 20:56:33 -07:00
Jakub Narebski
1d782b03b0 gitweb: Make git_get_hash_by_path check type if provided
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 12:55:51 -07:00
Petr Baudis
16fdb4882e Fix showing of path in tree view
This patch fixes two things - links to all path elements except the last
one were broken since gitweb does not like the trailing slash in them, and
the root tree was not reachable from the subdirectory view.

To compensate for the one more slash in the front, the trailing slash is
not there anymore. ;-) I don't care if it stays there though.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 01:16:45 -07:00
Martin Waitz
053d62bb5b gitweb: fix display of trees via PATH_INFO.
When adding a / to the URL, git should display the corresponding
tree object, but it has to remove the / first.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 01:15:23 -07:00
Jakub Narebski
62e27f273d gitweb: Fix thinko in git_tags and git_heads
git_get_refs_list always return reference to list (and reference to
hash which we ignore), so $taglist (in git_tags) and $headlist (in
git_heads) are always defined, but @$taglist / @$headlist might be
empty. Replaced incorrect "if (defined @$taglist)" with
"if (@$taglist)" in git_tags and respectively in git_heads.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 10:26:08 -07:00
Jakub Narebski
120ddde2a8 gitweb: Make git_get_refs_list do work of git_get_references
Make git_get_refs_list do also work of git_get_references, to avoid
calling git-peek-remote twice.  Change meaning of git_get_refs_list
meaning: it is now type, and not a full path, e.g. we now use
git_get_refs_list("heads") instead of former
git_get_refs_list("refs/heads").

Modify git_summary to use only one call to git_get_refs_list instead
of one call to git_get_references and two to git_get_refs_list.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 10:26:05 -07:00
Jakub Narebski
9704d75ddc gitweb: Always use git-peek-remote in git_get_references
Instead of trying to read info/refs file, which might not be present
(we did fallback to git-ls-remote), always use git-peek-remote in
git_get_references.

It is preparation for git_get_refs_info to also return references
info.  We should not use info/refs for git_get_refs_info as the
repository is not served for http-fetch clients.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 10:24:44 -07:00
Jakub Narebski
d04d3d424b gitweb: Require project for almost all actions
Require that project (repository) is given for all actions except
project_list, project_index and opml.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 09:49:39 -07:00
Jakub Narebski
cd90e75ff4 gitweb: Even more support for PATH_INFO based URLs
Now the following types of path based URLs are supported:

* project              overview (summary) page of project
* project/branch       shortlog of branch
* project/branch:file  file in branch, blob_plain view
* project/branch:dir/  directory listing of dir in branch, tree view

The following shortcuts works (see explanation below):

* project/branch:      directory listing of branch, main tree view
* project/:file        file in HEAD (raw)
* project/:dir/        directory listing of dir in HEAD
* project/:            directory listing of project's HEAD

We use ':' as separator between branch (ref) name and file name
(pathname) because valid branch (ref) name cannot have ':' inside.
This limit applies to branch name only. This allow for hierarchical
branches e.g. topic branch 'topic/subtopic', separate remotes
tracking branches e.g. 'refs/remotes/origin/HEAD', and discriminate
between head (branch) and tag with the same name.

Empty branch should be interpreted as HEAD.

If pathname (the part after ':') ends with '/', we assume that pathname
is name of directory, and we want to show contents of said directory
using "tree" view. If pathname is empty, it is equivalent to '/' (top
directory).

If pathname (the part after ':') does not end with '/', we assume that
pathname is name of file, and we show contents of said file using
"blob_plain" view.

Pathname is stripped of leading '/', so we can use ':/' to separate
branch from pathname. The rationale behind support for PATH_INFO based
URLs was to support project web pages for small projects: just create
an html branch and then use an URL like
  http://nowhere.com/gitweb.cgi/project.git/html:/index.html
The ':/' syntax allow for working links between .html files served
in such way, e.g. <a href="main.html"> link inside "index.html"
would get
  http://nowhere.com/gitweb.cgi/project.git/html:/main.html.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 09:49:31 -07:00
Jakub Narebski
8059319acc gitweb: Fix mimetype_guess_file for files with multiple extensions
Fix getting correct mimetype for "blob_plain" view for files which have
multiple extensions, e.g. foo.1.html; now only the last extension
is used to find mimetype.

Noticed by Martin Waitz.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 07:54:29 -07:00
Matthias Lederhofer
ac8e3f2bb8 gitweb fix validating pg (page) parameter
Currently it is possible to give any string ending with a number as
page.  -1 for example is quite bad (error log shows probably 100
warnings).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17 15:10:23 -07:00
Matthias Lederhofer
645927cec8 gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17 14:47:46 -07:00