Use 's' (treat string as single line) regexp modifier in
git_get_hash_by_path (against future changes, probably unnecessary)
and in parse_ls_tree_line (when called with '-z'=>1 option) to secure
against filenames containing newline.
[jc: the hunk on git_get_hash_by_path was unneeded, and I noticed the
regexp was doing unnecessary capture, so fixed it up while I was at it.]
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add "--" after <commit-ish> or <tree-ish> argument to clearly mark it
as <commit-ish> or <tree-ish> and not pathspec, securing against refs
with the same names as files or directories in [live] repository.
Some wrapping to reduce line length as well.
[jc: with "oops, ls-tree does not want --" fix-up manually applied.]
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Blame fails for example on
block/ll_rw_blk.c at v2.6.19-rc3.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add a kind of "next" view in the bottom part of navigation bar for
"commitdiff" view.
For commitdiff between two commits:
(from: _commit_)
For commitdiff for one single parent commit:
(parent: _commit_)
For commitdiff for one merge commit
(merge: _commit_ _commit_ ...)
For commitdiff for root (parentless) commit
(initial)
where _link_ denotes hyperlink. SHA1 is shortened to 7 characters on
display, everything is perhaps unnecessary esc_html on display.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is purely cosmetic. Having git_get_* between two parse_* subroutines
violated a good convention to group related things together.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This seems to be a pre-++ residual declaration and it wasn't good for
anything at all besides flooding the webserver errorlog with "omg, our in
the same scope!!" warnings.
[jc: the patch was bogus by defining the variable which defeated a
later test that checked it with "defined", which I fixed up.]
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* maint:
gitweb: Check git base URLs before generating URL from it
Documentation: add git in /etc/services.
Documentation: add upload-archive service to git-daemon.
git-cherry: document limit and add diagram
diff-format.txt: Correct information about pathnames quoting in patch format
Check if each of git base URLs in @git_base_url_list is true before
appending "/$project" to it to generate project URL.
This fixes the error that for default configuration for gitweb in
Makefile, with GITWEB_BASE_URL empty (and "++GITWEB_BASE_URL++" being
"" in gitweb.cgi), we had URL of "/$project" in the summary view.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use --no-commit-id option to git-diff-tree command in git_commit and
git_commitdiff to filter out commit ID output that git-diff-tree adds
when called with only one <tree-ish> (not only for --stdin). Remove
filtering commit IDs from git-diff-tree output.
This option is in git since at least v1.0.0, so make use of it.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
On repo.or.cz, I want to support project 'forks', which are meant
for repositories which are spinoffs of a given project and share
its objects database through the alternates mechanism. But another
(and perhaps even greater) incentive for that is that those 'forked
projects' do not clutter the main project index but are completely
grouped inside of the project view.
A forked project is just like a normal project, but given project
$projectroot/$projname.git, the forked project resides in directory
$projectroot/$projname/$forkname.git. This is a somewhat arbitrary
naming rule, but I think that for now it's fine; if someone will need
something wildly different, let them submit a patch. The 'forked'
mode is by default off and can be turned on in runtime gitweb
configuration just like other features.
A project having forks is marked by a '+' (pointing to the list of
forks) in the project list (this could become some cutesy AJAXy
DHTML in the future), there is a forks section in the project
summary similar to the heads and tags sections, and of course
a forks view which looks the same as the root project list.
Forks can be recursive.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* jc/web:
gitweb: Print commit message without title in commitdiff only if there is any
gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
gitweb: Get rid of git_print_simplified_log
gitweb: Show project's README.html if available
gitweb: Do not automatically append " git" to custom site name
gitweb: Make search type a popup menu
gitweb: Restore object-named links in item lists
gitweb: use for-each-ref to show the latest activity across branches
* jc/web-blame:
gitweb: spell "blame --porcelain" with -p
blame: Document and add help text for -f, -n, and -p
gitweb: blame porcelain: lineno and orig lineno swapped
Remove git-annotate.perl and create a builtin-alias for git-blame
gitweb: use blame --porcelain
git-blame --porcelain
blame.c: move code to output metainfo into a separate function.
git-blame: --show-number (and -n)
git-blame: --show-name (and -f)
blame.c: whitespace and formatting clean-up.
Gitweb - provide site headers and footers
gitweb: blame: Mouse-over commit-8 shows author and date
gitweb: blame: print commit-8 on the leading row of a commit-block
Revert 954a618375
gitweb: prepare for repositories with packed refs.
gitweb: make leftmost column of blame less cluttered.
Print the rest of commit message (title, i.e. first line of commit
message, is printed separately) only if there is any.
In repository which uses signoffs this shouldn't happen, because
commit message should consist of at least title and signoff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Filter out commit ID output that git-diff-tree adds when called with
only one <tree-ish> (not only for --stdin) in git_commit and
git_commitdiff.
This also works with older git versions, which doesn't have
--no-commit-id option to git-diff-tree.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Replace calls to git_print_simplified_log with its expansion,
i.e. with calling git_print_log with appropriate options.
Remove no longer used git_print_simplified_log subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
If the repository includes a README.html file, show it in the summary page.
The usual "this should be in the config file" argument does not apply here
since this can be larger and having such a big string in the config file
would be impractical.
I don't know if this is suitable upstream, but it's one of the repo.or.cz
custom modifications that I've thought could be interesting for others
as well.
Compared to the previous patch, this adds the '.html' extension to the
filename, so that it's clear it is, well, HTML.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
If you customized the site name, you probably do not want the " git"
appended so that the page title is not bastardized; I want repo.or.cz pages
titled "Public Git Hosting", not "Public Git Hosting git" (what's hosting
what?).
This slightly changes the $site_name semantics but only very
insignificantly.
Signed-off-by: Petr Baudis <pasky@suse.cz>
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>
This restores the redundant links removed earlier. It supersedes my patch
to stick slashes to tree entries.
Sorry about the previous version of the patch, an unrelated snapshot link
addition to tree entries slipped through (and it it didn't even compile);
I've dropped the idea of snapshot links in tree entries in the meantime
anyway.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* master: (114 commits)
gitweb: Fix setting $/ in parse_commit()
daemon: do not die on older clients.
xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.
git-clone: honor --quiet
Documentation for the [remote] config
prune-packed: Fix uninitialized variable.
ignore-errors requires cl
git-send-email: do not pass custom Date: header
Use column indexes in git-cvsserver where necessary.
gitweb: Add '..' (up directory) to tree view if applicable
gitweb: Improve git_print_page_path
pager: default to LESS=FRSX not LESS=FRS
Make prune also run prune-packed
git-vc: better installation instructions
gitweb: Do not esc_html $basedir argument to git_print_tree_entry
gitweb: Whitespace cleanup - tabs are for indent, spaces are for align (2)
Fix usagestring for git-branch
git-merge: show usage if run without arguments
add the capability for index-pack to read from a stream
git-clone: define die() and use it.
...
* maint:
gitweb: Fix setting $/ in parse_commit()
daemon: do not die on older clients.
xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.
git-clone: honor --quiet
Documentation for the [remote] config
prune-packed: Fix uninitialized variable.
If the commit couldn't have been read, $/ wasn't restored to \n properly,
causing random havoc like git_get_ref_list() returning the ref names with
trailing \n.
Aside of potential confusion in the body of git_search(), no other $/
surprises are hopefully hidden in the code.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Adds '..' (up directory) link at the top of "tree" view listing,
if both $hash_base and $file_name are provided, and $file_name
is not empty string.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add link to "tree root" (root directory) also for not defined name,
for example for "tree" action without defined "file_name" which means
"tree root".
Add " / " at the end of path when $type eq "tree".
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* maint:
pager: default to LESS=FRSX not LESS=FRS
Make prune also run prune-packed
git-vc: better installation instructions
gitweb: Do not esc_html $basedir argument to git_print_tree_entry
gitweb: Whitespace cleanup - tabs are for indent, spaces are for align (2)
Fix usagestring for git-branch
git-merge: show usage if run without arguments
In git_tree, rename $base variable (which is passed as $basedir
argument to git_print_tree_entry) to $basedir. Do not esc_html
$basedir, as it is part of file_name ('f') argument in link and not
printed. Add '/' at the end only if $basedir is not empty (it is empty
for top directory) and doesn't end in '/' already.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Code should be aligned the same way, regardless of tab size.
Use tabs for indent, but spaces for align.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* mw/pathinfo:
gitweb: Fix search form when PATH_INFO is enabled
gitweb: Document features better
gitweb: warn if feature cannot be overridden.
gitweb: start to generate PATH_INFO URLs.
Conflicts:
gitweb/README
The project list page shows last change from the HEAD branch but
often people would want to view activity on any branch.
Unfortunately that is fairly expensive without the core-side
support. for-each-ref was invented exactly for that.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Currently that was broken. Ideal fix would make the search form use
PATH_INFO too, but it's just one insignificant place so it's no big deal if
we don't for now... This at least makes it work.
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>
This expands gitweb/README to talk some more about GITWEB_CONFIG, moves
feature-specific documentation in gitweb.cgi to the inside of the %features
array, and adds some short description of all the features.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
There's no reason for that, the commitdiff view is meaningful for the
root commit as well and we link to it everywhere else.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Currently those look very weird, you can't get easily at the commit view
etc. This patch makes their title '(no commit message)'.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Currently it's pasted to the sha1 of the blob and looks ugly.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
we already had a few place using decode() to convert perl internal
encode to utf8. added a new thin wrapper to do just that.
Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This makes gitweb (git_blame2) use "blame --porcelain", which
lets the caller to figure out which line in the original version
each line comes from. Using this information, change the
behaviour of clicking the line number to go to the line of the
blame output for the original commit.
Before, clicking the line number meant "scoll up to show this
line at the beginning of the page", which was not all that
useful. The new behaviour lets you click on the line you are
interested in to view the line in the context it was introduced,
and keep digging deeper as you examine it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
* jc/blame:
git-blame --porcelain
blame.c: move code to output metainfo into a separate function.
git-blame: --show-number (and -n)
git-blame: --show-name (and -f)
blame.c: whitespace and formatting clean-up.
gitweb: Make the Git logo link target to point to the homepage
gitweb: blame: Minimize vertical table row padding
gitweb: Do not print "log" and "shortlog" redundantly in commit view
vc-git.el: Switch to using git-blame instead of git-annotate.
git.el: Fixed inverted "renamed from/to" message.
tar-tree deprecation: we eat our own dog food.
Add git-upload-archive to the main git man page
git-commit: cleanup unused function.
Fix usage string to match that given in the man page
Update the gitweb/README file to include setting the GITWEB_CONFIG environment
Conflicts:
gitweb/gitweb.perl
It provides more useful information for causual Git users than the Git docs
(especially about where to get Git and such).
People can override with GITWEB_CONFIG if they want to.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Acked-by: Petr Baudis <pasky@suse.cz>
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>
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>
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>
If the administrator configures pathinfo to be overrideable by the
local repository a warning is shown.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This allows web sites with a header and footer standard for each page
to add them to the pages produced by gitweb.
Two new variables $site_header and $site_footer are defined (default
to null) each of which can specify a file containing the header and
footer html.
In addition, if the $stylesheet variable is undefined, a new array
@stylesheets (which defaults to a single element of gitweb.css) can be
used to specify more than one style sheet. This allows the clasical
gitweb.css styles to be retained, but a site wide style sheet used
within the header and footer areas.
Signed-off-by: Alan Chandler <alan@chandlerfamily.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Print commit-8 only on the first, leading row of
a commit block, to complement the per-commit block coloring.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Luben makes a good argument against it, and I agree with him in general.
The clickable handle that appear at seemingly random places makes them
look as if they are separating groups when it is not.
This also restores the executable bit I lost by mistake.
Signed-off-by: Junio C Hamano <junkio@cox.net>
When a repository is initialized long time ago with symbolic
HEAD, and "git-pack-refs --prune" is run, HEAD will be a
dangling symlink to refs/heads/ somewhere.
Running -e "$dir/HEAD" to guess if $dir is a git repository does
not give us the right answer anymore in such a case.
Also factor out two places that checked if the repository can be
exported with similar code into a call to a new function,
check_export_ok.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Instead of labelling each and every line with clickable commit
object name, this makes the blame output to show them only on
the first line of each group of lines from the same revision.
Placing too many lines in one group would make the commit object
name to appear too widely separated and also makes it consume
more memory, the number of lines in one group is capped to 20
lines or so.
Also it makes mouse-over to show the minimum authorship and
authordate information for extra cuteness ;-).
Signed-off-by: Junio C Hamano <junkio@cox.net>
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>
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>
Instead of providing the project as a ?p= parameter it is simply appended to
the base URI. All other parameters are appended to that, except for ?a=summary
which is the default and can be omitted.
The this can be enabled with the "pathinfo" feature in gitweb_config.perl.
[jc: let's introduce new features disabled by default not to
upset too many existing installations.]
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* 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"
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>