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>
$export_ok: If this variable evaluates to true it is checked
if a file with this name exists in the repository. If it
does not exist the repository cannot be viewed from gitweb.
(Similar to git-daemon-export-ok for git-daemon).
$strict_export: If this variable evaluates to true only
repositories listed on the project-list-page of gitweb can
be accessed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Perl spit out a varning when "blob" or "blob_plain" actions were
used without a $hash parameter.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Now three types of path based URLs are supported:
gitweb.cgi/project.git
gitweb.cgi/project.git/branch
gitweb.cgi/project.git/branch/filename
The first one (show project summary) was already supported for a long time
now. The other two are new: they show the shortlog of a branch or
the plain file contents of some file contained in the repository.
This is especially useful to support project web pages for small
projects: just create an html branch and then use an URL like
gitweb.cgi/project.git/html/index.html.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add link to "project_index" view as [TXT] beside link to "opml" view,
(which is marked by [OPML]) to "project_list" page.
While at it add alternate links for "opml" and "project_list" to HTML
header for "project_list" view.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Make it possible to use href() subroutine to generate link with
query string which does not include project ('p') parameter.
href() used to add project=$project to its parameters, if it
was not set (to be more exact if $params{'project'} was false).
Now you can pass "project => undef" if you don't want for href()
to add project parameter to query string in the generated link.
Links to "project_list", "project_index" and "opml" (all related
to list of all projects/all git repositories) doesn't need project
parameter. Moreover "project_list" is default view (action) if
project ('p') parameter is not set, just like "summary" is default
view (action) if project is set; project list served as a kind
of "home" page for gitweb instalation, and links to "project_list"
view were done without specyfying it as an action.
Convert remaining links (except $home_link and anchor links)
to use href(); this required adding 'order => "o"' to @mapping
in href(). This finishes consolidation of URL generation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add git_project_index, which generates index.aux file that can be used
as a source of projects list, instead of generating projects list from
a directory. Using file as a source of projects list allows for some
projects to be not present in gitweb main (project_list) page, and/or
correct project owner info. And is probably faster.
Additionally it can be used to get the list of all available repositories
for scripts (in easily parseable form).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is in response to Linus's work on packed refs. Additionally it
makes gitweb work with symrefs, too.
Do not parse refs by hand, using File::Find and reading individual
heads to get hash of reference, but use git-peek-remote output
instead. Assume that the hash for deref (with ^{}) always follows hash
for ref, and that we have derefs only for tag objects; this removes
call to git_get_type (and git-cat-file -t invocation) for tags, which
speeds "summary" and "tags" views generation, but might slow generation
of "heads" view a bit. For now, we do not save and use the deref hash.
Remove git_get_hash_by_ref while at it, as git_get_refs_list was the
only place it was used.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Earlier code to get list of projects when $projects_list is a
directory (e.g. when it is equal to $projectroot) had a hardcoded flat
(one level) list of directories. Allow for projects to be in
subdirectories also for $projects_list being a directory by using
File::Find.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git_history output is now divided into pages, like git_shortlog,
git_tags and git_heads output. As whole git-rev-list output is now
read into array before writing anything, it allows for better
signaling of errors.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
As pickaxe search (selected using undocumented 'pickaxe:' operator in
search query) is resource consuming, allow to turn it on/off using
feature meachanism. Turned on by default, for historical reasons.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Divide page path into directories, so that each part of path links to
the "tree" view of the $hash_base (or HEAD, if $hash_base is not set)
version of the directory.
If the entity is blob, final part (basename) links to $hash_base or
HEAD revision of the "raw" blob ("blob_plain" view). If the entity is
tree, link to the "tree" view.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change the name of diff to parent (current commit to one of parents)
link in "commit" view (git_commit subroutine) from "commitdiff" to
"diff". Let's leave "commitdiff" for equivalent of git-show, or
git-diff-tree with one revision, i.e. diff for a given commit to its
parent (parents).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Extend parse_difftree_raw_line to save commit info from when
git-diff-tree is given only one <tree-ish>, for example when fed
from git-rev-list using --stdin option.
git-diff-tree outputs a line with the commit ID when applicable.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is preparation for "tree blame" (similar to what ViewVC shows)
output, i.e. for each entry give commit where it was changed.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add new subroutine parse_ls_tree_line and use it in git_tree.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
When run under mod_perl, require() will read and execute the configuration
file on the first invocation only. On every subsequent invocation, all
configuration variables will be reset to their default values. do() reads
and executes the configuration file unconditionally.
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
On Aug 27th, Jakub Narebski sent a patch which removed the git_to_hash()
function and this call to it. The patch did not apply cleanly and had to
be applied manually. Removing the last chunk has obviously been forgotten.
See: commit 0aea33762b and
message <200608272345.26722.jnareb@gmail.com>
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add local time (hours and minutes) and local timezone to the output of
git_print_authorship command, used by git_commitdiff. The code was
taken from git_commit subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Added/uncommented git_difftree_body invocation in git_commitdiff.
Added anchors (via 'id' attribute) to patches in patchset.
git_difftree_body is modified to link to patch anchor when called from
git_commitdiff, instead of link to blobdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This correct minor error in git_print_log that didn't add final empty
line when requested, if commit log ended with signoff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add subroutine git_print_authorship to print author and date of
commit, div.author_date style to CSS, and use them in git_commitdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Remove '-remove_signoff => 1' option to git_print_log call in the
git_print_simplified_log subroutine. This means that in "log" and
"commitdiff" views (git_log and git_commitdiff subroutines) signoff
lines will be shown.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Collapse git_print_log and git_print_simplified_log into one
subroutine git_print_log. git_print_simplified_log now simply calls
git_print_log with proper options.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This makes it possible to run gitweb under mod_perl's Apache::Registry.
It needs a fairly new git version, with --git-dir=<path>
parameter to git wrapper, i.e. post v1.4.2-rc2-g6acbcb9 version.
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Added new global configuration variable @diff_opts, which holds
additional options (parameters) to git-diff and git-diff-tree, usually
dealing rename/copying detection. Default value is '-M', taken from
git_commit subroutine. Description of options and their approximate
cost by Junio C Hamano.
Changes:
* git_commitdiff, git_blobdiff and git_blobdiff_plain now use '-M'
instead of '-M', '-C'
* git-diff now uses the same options as git-diff-tree
* git_comittdiff_plain now uses '-M' instead of '-B'
and is now rename-aware
* git_rss uses now '-M' instead of ()
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Remove git_to_hash function, which was to translate symbolic reference
to hash, and it's use in git_blobdiff. We don't try so hard to guess
filename if it was not provided.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Remove unused (and with errors in implementation)
git_get_{preceding,following}_references subroutines.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Remove workaround in git_blobdiff for error in git-diff (showing
reversed diff for diff of blobs), corrected in commit f82cd3c
Fix "git diff blob1 blob2" showing the diff in reverse. which
is post 1.4.2-rc2 commit.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
* master: (34 commits)
gitweb: git_annotate didn't expect negative numeric timezone
git-svn: add the 'dcommit' command
git-svn: recommend rebase for syncing against an SVN repo
git-svn: establish new connections on commit after fork
describe: fix off-by-one error in --abbrev=40 handling
git-svn(1): improve asciidoc markup
gitview.txt: improve asciidoc markup
git(7): put the synopsis in a verse style paragraph
gitk(1): expand the manpage to look less like a template
git-blame(1): mention options in the synopsis and advertise pickaxe
git-ls-remote(1): document --upload-pack
git-apply(1): document missing options and improve existing ones
update-index -g
n is in fact unused, and is later shadowed.
use name[len] in switch directly, instead of creating a shadowed variable.
builtin-grep.c: remove unused debugging piece.
remove ugly shadowing of loop indexes in subloops.
missing 'static' keywords
git_dir holds pointers to local strings, hence MUST be const.
avoid to use error that shadows the function name, use err instead.
...
Remove $git_temp variable which held location for temporary files
needed by git_diff_print, and removed creating $git_temp directory.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Remove git_diff_print subroutine, used to print diff in previous
versions of "diff" actions, namely git_commitdiff,
git_commitdiff_plain, git_blobdiff, git_blobdiff_plain.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git_blobdiff and git_blobdiff_plain are now collapsed into one
subroutine git_blobdiff, with format (currently 'html' which is
default format corresponding to git_blobdiff, and 'plain'
corresponding to git_blobdiff_plain) specified in argument.
blobdiff_plain format is now generated either by git-diff-tree
or by git-diff. Added X-Git-Url: header. From-file and to-file name
in header are corrected.
Note that for now commitdiff_plain does not detect renames
and copying, while blobdiff_plain does.
While at it, set expires to "+1d" for non-textual hash ids.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is second part of removing gitweb dependency on external
diff (used in git_diff_print).
Get rid of git_diff_print invocation in git_blobdiff, and use either
git-diff-tree (when both hash_base and hash_parent_base are provided)
patch format or git-diff patch format (when only hash and hash_parent
are provided) for output.
Supported URI schemes, and output formats:
* New URI scheme: both hash_base and hash_parent_base (trees-ish
containing blobs versions we want to compare) are provided.
Also either filename is provided, or hash (of blob) is provided
(we try to find filename then).
For this scheme we have copying and renames detection, mode changes,
file types etc., and information extended diff header is correct.
* Old URI scheme: hash_parent_base is not provided, we use hash and
hash_parent to directly compare blobs using git-diff. If no filename
is given, blobs hashes are used in place of filenames.
This scheme has always "blob" as file type, it cannot detect mode
changes, and we rely on CGI parameters to provide name of the file.
Added git_to_hash subroutine, which transforms symbolic name or list
of symbolic name to hash or list of hashes using git-rev-parse.
To have "blob" instead of "unknown" (or "file" regardless of the type)
in "gitweb diff header" for legacy scheme, file_type function now
returns its argument if it is not octal string.
Added support for fake "2" status code in git_patchset_body. Such code
is generated by git_blobdiff in legacy scheme case.
ATTENTION: The order of arguments (operands) to git-diff is reversed
(sic!) to have correct diff in the legacy (no hash_parent_base) case.
$hash_parent, $hash ordering is commented out, as it gives reversed
patch (at least for git version 1.4.1.1) as compared to output in new
scheme and output of older gitweb version.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change replacing hashes as from-file/to-file with filenames from
difftree to adding invisible (except underlining on hover/mouseover)
hyperlink to from-file/to-file blob. /dev/null as from-file or
to-file is not changed (is not hyperlinked).
This makes two-file from-file/to-file unified diff header parsing in
git_patchset_body more generic, and not only for legacy blobdiffs.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Parse two-line from-file/to-file unified diff header in
git_patchset_body directly, instead of leaving pretty-printing to
format_diff_line function. Hashes as from-file/to-file are replaced
by proper from-file and to-file names (from $diffinfo); in the future
we can put hyperlinks there. This makes possible to do blobdiff with
only blobs hashes.
The lines in two-line unified diff header have now class "from_file"
and "to_file"; the style is chosen to match previous output (classes
"rem" and "add" because of '-' and '+' as first character of patch
line).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Preparation for converting git_blobdiff and git_blobdiff_plain
to use git-diff-tree patch format to generate patches.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add support for hash_parent_base in input validation part and in
href() function. Add proper hash_parent_base to all calls to blobdiff
and blobdiff_plain action URLs. Use hash_parent_base as hash_base for
blobs of hash_parent.
To be used in future rewrite of git_blobdiff and git_blobdiff_plain.
While at it, move project before action in ordering CGI parameters in
href().
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use git_get_rev_name_tags function for X-Git-Tag: header in
git_commitdiff('plain'), i.e. for commitdiff_plain action.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add git_get_rev_name_tags function, for later use in
git_commitdiff('plain') for X-Git-Tag: header.
This function, contrary to the call to
git_get_following_references($hash, "tags");
_does_ strip "tags/" and returns bare tag name.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Return on first ref found when git_get_preceding_references
is called in scalar context
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Adds git_get_following_references function, based on code which was
used in git_commitdiff_plain to generate X-Git-Tag: header,
and companion git_get_preceding_references function.
Both functions return array of all references of given type (as
returned by git_get_references) following/preceding given commit in
array (list) context, and last following/first preceding ref in scalar
context.
Stripping ref (list of refs) of "$type/" (e.g. "tags/") is left to
caller.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change output of patch(set) in git_commitdiff from slurping whole diff
in @patchset array before processing, to passing file descriptor to
git_patchset_body.
Advantages: faster, incremental output, smaller memory footprint.
Disadvantages: cannot react when there is error during closing file
descriptor.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
In format_diff_line, instead of skipping errors/incomplete lines,
for example
"\ No newline at end of file"
in HTML pretty-printing of diff, use "incomplete" class for div.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Get rid of git_diff_print invocation in git_commitdiff and therefore
external diff (/usr/bin/diff) invocation, and use only git-diff-tree
to generate patch.
git_commitdiff and git_commitdiff_plain are collapsed into one
subroutine git_commitdiff, with format (currently 'html' which is
default format corresponding to git_commitdiff, and 'plain'
corresponding to git_commitdiff_plain) specified in argument.
Separate patch (diff) pretty-printing into git_patchset_body.
It is used in git_commitdiff.
Separate patch (diff) line formatting from git_diff_print into
format_diff_line function. It is used in git_patchset_body.
While at it, add $hash parameter to git_difftree_body, according to
rule that inner functions should use parameter passing, and not global
variables.
CHANGES TO OUTPUT:
* "commitdiff" now products patches with renaming and copying
detection (git-diff-tree is invoked with -M and -C options).
Empty patches (mode changes and pure renames and copying)
are not written currently. Former version broke renaming and
copying, and didn't notice mode changes, like this version.
* "commitdiff" output is now divided into several div elements
of class "log", "patchset" and "patch".
* "commitdiff_plain" now only generates X-Git-Tag: line only if there
is tag pointing to the current commit. Former version which wrote
first tag following current commit was broken[*1*]; besides we are
interested rather in tags _preceding_ the commit, and _heads_
following the commit. X-Git-Url: now is current URL; former version
tried[*2*] to output URL to HTML version of commitdiff.
* "commitdiff_plain" is generated by git-diff-tree, and has therefore
has git specific extensions to diff format: "git diff" header and
optional extended header lines.
FOOTNOTES
[*1*] First it generated rev-list starting from HEAD even if hash_base
parameter was set, second it wasn't corrected according to changes
made in git_get_references (formerly read_info_ref) output, third even
for older version of read_info_ref output it didn't work for multiple
tags pointing to the current commit (rare).
[*2*] It wrote URL for commitdiff without hash_parent, which produces
diff to first parent and is not the same as current diff if it is diff
of merge commit to non-first parent.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Restore pre-1c2a4f5addce479c619057c6cdc841802139982f
ordering of CGI parameters.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
If someone would enter parameter name incorrectly, and some key of
%params is not found in %mapping hash, the parameter is now
ignored. Change introduced by Martin Waitz in commit
756d2f064b
tried to do that, but it left empty value and there was doubled ";;"
in returned string.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Route rest of action subroutines, namely git_project_list and git_opml
(both of which doesn't need $project) through %actions hash.
This has disadvantage that all parameters are read and validated;
earlier git_opml was called as soon as $action was parsed and
validated, git_project_list was called as soon as $project was parsed
and validated. This has advantage that all action dispatch is grouped
in one place.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use underscore (which will be turned into hyphen) to separate words in
HTTP header names, in keys to CGI header() method, consistently.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This patch tries (but no too hard) to fit gitweb source in 80 columns,
for 2 columns wide tabs, and indent and align source for better
readibility.
While at it added comment to 'snapshot' entry defaults for %feature
hash, corrected "blobl" action in git_blame2 and git_blame to "blob",
key of argument to $cgi->a from 'class' to '-class'.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Fix regression introduced by
commit 17d0744318.
"a.list" being "bold", makes a myriad of things shown by
gitweb in bold font-weight, which is a regression from
pre-17d07443188909ef5f8b8c24043cb6d9fef51bca behavior.
The fix is to add "subject" class and use this class
to replace pre-format_subject_html formatting of subject
(comment) via using (or not) <b>...</b> element. This
should go back to the pre-17d0744318... style.
Regression noticed by Luben Tuikov.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use newly introduced parse_difftree_raw_line function in the
git_difftree_body subroutine. While at it correct error in
parse_difftree_raw_line (unquote is unprototyped function), and
add comment explaining this function.
It also refactors git_difftree_body somewhat, and tries to fit
it in 80 columns.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Adds parse_difftree_raw_line function which parses one line of "raw"
format diff-tree output into a hash.
For later use in git_difftree_body, git_commitdiff and
git_commitdiff_plain, git_search.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This adds blame and snapshot to the feature associative array. This
also helps in enabling or disabling these features via GITWEB_CONFIG
and overriding if allowed via project specfic config.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
[jc: when I applied the patch I misread RFC 2616 which mildly
recommended against using the name "gzip", which was there only
for a historical reason. This fixes the mistake up and uses
the content-encoding "x-gzip" again.]
Signed-off-by: Junio C Hamano <junkio@cox.net>
If a file F exists in branch B, but doesn't exist
in master branch, then blob_plain needs the hash base in
order to properly get the file. The hash base is passed
on symbolically so we still preserve the "latest" quality
of the link presented by git_print_page_path().
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Fix regression in git_commitdiff() introduced
by commit 756d2f064b.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This adds snapshort support in gitweb. To enable one need to
set gitweb.snapshot = true in the config file.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@hp.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separate pretty-printing commit message (comment) into git_print_log
and git_print_simplified_log subroutines. As of now the former is used
in git_commit, the latter in git_log and git_commitdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The project list now uses several common header / footer generation functions.
These functions only check for "defined $project", but when PATH_INFO just
contains a "/" (which is often generated by web servers), then this test
fails.
Now explicitly undef $project if there is none so that the tests in other
gitweb parts work again.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
If the webserver is configured to use gitweb even for the root directory
of the site, then my_uri is empty which leads to a non-functional home
link. Fix that by defaulting to "/" in this case.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The "fp" (file name parent) parameter was previously generated for
blob diffs of renamed files. However, it was not used in any code.
Now href() can generate "fp" parameters and they are used by the
blobdiff code to show the correct file name.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Further use href() instead of URL generation by string concatenation.
Almost all functions are converted now.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.
If there is no cloneurl file, concatenation of git base URLs with
project name is used.
This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use the href() function instead of string concatenation to generate
most URLs to our own CGI.
This is a work in progress, not everything has been converted yet.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Provide a new function which can be used to generate an URL for the CGI.
This makes it possible to consolidate the URL generation in order to make
it easier to change the encoding of actions into URLs.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
Date: Tue, 15 Aug 2006 11:43:04 -0700
Subject: [PATCH] gitweb: Show project's git URL on summary page
Add support for showing multiple clone/fetch git URLs for project on
a summary page. URL for project is created from base URL and project
name.
For example for XMMS2 project (xmms.se) the git base URL would be
git://git.xmms.se/xmms2.
With corrections from David Rientjes <rientjes@google.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
I've always found difficult to figure out git URL for clone from
gitweb URL because git:// and http:// are different on many site
including kernel.org.
I've found this enhancement at http://dev.laptop.org/git when I was on
git channel, and thought that it'd be nice if all public gitweb site
show it's git URL on its page.
This patch allow us to change the home link string. The current
default is "projects" as we all see on gitweb now.
ie. kernel.org might set this variable to "git://git.kernel.org/pub/scm/"
Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separate printing difftree in git_commit into separate
git_difftree_body subroutine. Add support for "C" (copied) status. For
"M" and "C" add parameter 'fp' (filename parent) to the "diff" link;
currently not supported by git_blobdiff ("blobdiff" action).
Reindented, realigned, added comments.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
True fix for error in mimetype_guess, error introduced in original commit
2d00737489 and later fixed temporarily
by commenting out the line that caused error in commit
57bd4d3523.
Gitweb now supports mime.types map $mimetypes_file relative to project.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Change git_get_references to include type of ref in the %refs value, which
means putting everything after 'refs/' as a ref name, not only last
part of the name. Instead of separating refs pointing to the same
object by " / " separator, use anonymous array reference to store all
refs pointing to given object.
Use 'git-ls-remote .' if $projectroot/$project/info/refs does not
exist. (Perhaps it should be used always.)
Refs are now in separate span elements. Class is dependent on the ref
type: currently known classes are 'tag', 'head', 'remote', and 'ref'
(last one for HEAD and other refs in the main directory). There is
encompassing span element of class refs, just in case of unknown ref
type.
This might be considered cleaner separating of git_get_references into
filling %refs hash only, and not taking part in formatting ref marker.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separates main part of git_history into git_history_body subroutine,
and makes output more similar to git_shortlog. Adds "diff to current"
link only for history of regular file (blob).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Separate printing of perhaps shortened title (subject) in
git_shortlog_body and git_tags_body into format_subject_html.
While at it, remove presentation element <b>...</b> used to format
title (subject) and move formatting to CSS.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Note that for each ref there are usually two calls to git subroutines:
first to get the type of ref, second to parse ref if ref is of commit
or tag type.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Rename some of subroutines to better reflect what they do.
Some renames were not performed because subroutine name
reflects hash key.
Subroutines name guideline:
* git_ prefix for subroutines related to git commands,
git repository, or to gitweb actions
* git_get_ prefix for inner subroutines calling git command
or reading some file in the repository and returning some output
* parse_ prefix for subroutines parsing some text (or reading and
parsing some text) into hash or list
* format_ prefix for subroutines formatting, post-processing
or generating some HTML/text fragment
* _get_ infix for subroutines which return result
* _print_ infix for subroutines which print fragment of output
* _body suffix for subroutines which outputs main part (body)
of related action (usually table)
* _nav suffix for subroutines related to navigation bars
* _div suffix for subroutines returning or printing div element
* subroutine names should not be based on how the result is obtained,
as this might change easily
Renames performed:
- git_get_referencing => format_ref_marker
- git_get_paging_nav => format_paging_nav
- git_read_head => git_get_head_hash
- git_read_hash => git_get_hash_by_ref
- git_read_description => git_get_project_description
- git_read_projects => git_get_projects_list
- read_info_ref => git_get_references
- git_read_refs => git_get_refs_list
- date_str => parse_date
- git_read_tag => parse_tag
- git_read_commit => parse_commit
- git_blob_plain_mimetype => blob_mimetype
- git_page_nav => git_print_page_nav
- git_header_div => git_print_header_div
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Until now blame just used the commit/tree/tags/etc style of
highlight-able table rows, which have alternating light/dark rows that
flash when mouse pointer passes over them. This is very annoying in
blame, since the text is static and it interferes with the
per-revision block highlighting.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
In git_commit() the hash base of $from_id is $parent, not
$hash:
- If status is "D", then action blob for $from_id wants
$parent, not $hash. History needs $parent too.
- If status is "R", then action blob for $from_id wants
$parent, not $hash.
Similarly in git_commitdiff() the hash base of $from_id is
$hash_parent, not $hash.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
There were some places where $project was used even if it was not
defined.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This fixes error for commitdiff on root commit (without parents).
Noticed-by: Matthias Lederhofer (matled)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
After changing all "-|" open invocations to list form, commitdiff for
initial commit (without parent) got broken; it returned incorrectly
empty patch earlier. Use '--root' option to git-diff-tree for initial
(root) commit.
No checking for empty $hash_parent in git_commitdiff_plain -- we rely
on gitweb to give correct parameters for commitdiff_plain action.
Noticed by Matthias Lederhofer (matled).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add untabify subroutine and use it. It also fixes git_diff_print
which used to get the tabstop wrong.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git_tree() will now conditionally display "blame"
depending on how "gitweb.blame" variable is configured
using "git-repo-config".
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This makes it easier to run gitweb/gitweb.perl without token substitution.
Using @@ makes Perl emit "unintended interpolation" warnings.
Signed-off-by: Junio C Hamano <junkio@cox.net>
With this patch it is possible to use gitweb.perl for developing by
loading the configuration from $GITWEB_CONFIG. This might also be
useful for normal usage of gitweb.
Example:
% cat cfg
$GIT = '/usr/bin/git';
$projectroot = '/home/matled/src/git';
$projects_list = '/home/matled/src/git/git/gitweb/list';
% cat run
#!/bin/sh
export GATEWAY_INTERFACE="CGI/1.1"
export HTTP_ACCEPT="*/*"
export REQUEST_METHOD="GET"
export GITWEB_CONFIG='./cfg'
export QUERY_STRING=""$1""
exec ./gitweb.perl
% time ./run p=git/.git > /dev/null
This makes it easy to check for warnings and do performance tests
after changes, you can also pipe this to lynx -dump -force-html
/dev/stdin to get more than just html.
This also documents the original patch adding require $GITWEB_CONFIG.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Configuration will first be taken from variables inside the gitweb.cgi
script, which in turn come from the Makefile. Afterwards, the contents of
GITWEB_CONFIG are read, overriding the builtin defaults.
This should eliminate the need for editing the gitweb script at all. Users
should edit the Makefile and/or add a config file.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use the normal web server instead of the CGI to provide the git logo,
just like the gitweb.css.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi
by the end user. The GIT installation directory is already known
by the Makefile, and can be inserted directly into gitweb.
All other gitweb configuration parameters can now be specified by
providing GITWEB_* variables while building GIT. These are described
in gitweb/README.
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>