Commit Graph

518 Commits

Author SHA1 Message Date
Jakub Narebski
785cdea9be gitweb: Fix "Use of unitialized value" warnings in empty repository
Fix it so gitweb doesn't write "Use of unitialized value..." warnings
(which gets written in web server logs) for empty (no commits)
repository.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This ability is not used yet.

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

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

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

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-07 18:20:19 -07:00
Jakub Narebski
ed224deac9 gitweb: Add combined diff support to git_difftree_body
You have to pass all parents as final parameters of git_difftree_body
subroutine; the number of parents of a diff must be equal to the
number derived from parsing git-diff-tree output, raw combined diff
for git_difftree_body to display combined diff correctly (but it is
not checked).

Currently the possibility of displaying diffree of combined diff is
not used in gitweb code; git_difftree_body is always caled for
ordinary diff, and with only one parent.

Description of output for combined diff:
----------------------------------------

The difftree table for combined diff starts with a cell with pathname
of changed blob (changed file), which if possible is hidden link
(class="list") to the 'blob' view of final version (if it exists),
like for difftree for ordinary diff. If file was deleted in the final
commit then filename is not hyperlinked.

There is no cell with single file status (new, deleted, mode change,
rename), as for combined diff as there is no single status: different
parents might have different status.

If git_difftree_body was called from git_commitdiff (for 'commitdiff'
action) there is inner link to anchor to appropriate fragment (patch)
in patchset body; the "patch" link does not replace "diff" link like
for ordinary diff.

Each of "diff" links is in separate cell, contrary to output for
ordinary diff in which all links are (at least for now) in a single
cell.

For each parent, if file was not present we leave cell empty. If file
was deleted in the result, we provide link to 'blob' view. Otherwise
we provide link to 'commitdiff' view, even if patch (diff) consist
only of extended diff header, and contents is not changed (pure
rename, pure mode change). The only difference is that link to
"blobdiff" view with no contents change is with 'nochange' class.

At last, there is provided link to current version of file as "blob"
link, if the file was not deleted in the result, and lik to history of
a file, if there exists one. (The link to file history might be
confused, at least for now, by renames.)

Note that git-diff-tree raw output dor combined diff does not provide
filename before change for renames and copies; we use
git_get_path_by_hash to get "src" filename for renames (this means
additional call to git-ls-tree for a _whole_ tree).

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

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

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

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-03 23:22:12 -07:00
Martin Koegler
4280cde95f gitweb: Show "no difference" message for empty diff
Currently, gitweb shows only header and footer, if no differences are
found. This patch adds a "No differences found" message for the html
output.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-22 22:49:25 -07:00
Frank Lichtenheld
b06dcf8cb8 gitweb: Allow configuring the default projects order and add order 'none'
Introduce new configuration variable $default_projects_order
that can be used to specify the default order of projects on
the index page if no 'o' parameter is given.

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

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

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

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

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

Noticed-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 14:14:55 -07:00
Jakub Narebski
3be8e720d9 gitweb: Quote hash keys, and do not use barewords keys
Ensure that in all references to an element of a hash, the
key is singlequoted, instead of using bareword: use $hash{'key'}
instead of $hash{key}

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

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

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

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

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

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

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

	git diff [options] hpb:fp hp:f

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 00:47:48 -07:00
Jakub Narebski
f73bbb2d0c gitweb: Cleanup and uniquify die_error calls
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-27 12:58:23 -07:00
Junio C Hamano
b08bbae7e1 Merge branch 'maint'
* maint:
  gitweb: Fix "next" link in commit view
2007-03-23 23:29:37 -07:00
Jakub Narebski
f9308a182e gitweb: Fix "next" link in commit view
Fix copy'n'paste error in commit c9d193df which caused that "next"
link for merge commits in "commit" view
  (merge: _commit_ _commit_ ...)
was to "commitdiff" view instead of being to "commit" view.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-23 14:54:52 -07:00
Jakub Narebski
edc04e90f5 gitweb: Don't escape attributes in CGI.pm HTML methods
There is no need to escape HTML tag's attributes in CGI.pm
HTML methods (like CGI::a()), because CGI.pm does attribute
escaping automatically.

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

is translated to

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

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

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

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

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

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

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-06 03:08:06 -08:00
Junio C Hamano
c8f80d4dc8 gitweb: fix mismatched parenthesis
An earlier commit 04179418 broke gitweb.  Badly.

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

use to_utf8() to do the conversion.

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

This patch also removes some commented out code in git_patchset_body.

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

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

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

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

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

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

While at it, fix align.

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

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

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

The commit id displayed is hyperlinked to the commit.

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

This patch makes such data mining possible.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This makes the following changes:

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

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

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

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

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

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

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

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

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

Link target is _not_ hyperlinked.

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

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

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

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

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

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

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-06 11:11:58 -08:00
Jakub Narebski
e1147267af gitweb: Fix Atom feed <logo>: it is $logo, not $logo_url
Fix contents of Atom feed <logo> element; it should be URL
of $logo, not URL pointed by logo link.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-04 13:48:58 -08:00
Jakub Narebski
e88ce8a456 gitweb: Make project description in projects list link to summary view
Make (shortened) project description in the "projects list" view
hyperlink to the "summary" view of the project. Project names are
sometimes short; having project description be hyperling gives larger
are to click. While at it, display full description on mouseover via
'title' attribute to introduced link.

Additionally, fix whitespace usage in modified git_project_list_body
subroutine: tabs are for indent, spaces are for align.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 20:00:22 -08:00
Jakub Narebski
91fd2bf3fd gitweb: Use author_epoch for pubdate in gitweb feeds
Use creation date (author_epoch) instead of former commit date
(committer_epoch) as publish date in gitweb feeds (RSS, Atom).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 13:54:32 -08:00
Jakub Narebski
ab23c19d67 gitweb: Add author and contributor email to Atom feed
Add author email (from 'author_email') and contributor email (from
'committer_email') to items in the Atom format gitweb feed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 13:54:32 -08:00
Jakub Narebski
ba00b8c1ed gitweb: Add author and committer email extraction to parse_commit
Extract author email to 'author_email' key, and comitter mail to
'committer_mail' key; uniquify committer and author lines handling
by the way.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 13:54:32 -08:00
Jakub Narebski
28b9d9f7c6 gitweb: Use git-show-ref instead of git-peek-remote
Use "git show-ref --dereference" instead of "git peek-remote
$projectroot/project" in git_get_references. git-show-ref is faster
than git-peek-remote (40ms vs 56ms user+sys for git.git repository);
even faster is reading info/refs file (if it exists), but the
information in info/refs can be stale; that and the fact that
info/refs is meant for dumb protocol transports, not for gitweb.

git-show-ref is available since v1.4.4; the output format is slightly
different than git-peek-remote output format, but we accept both.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 13:54:32 -08:00
Jakub Narebski
391862e345 gitweb: Do not use esc_html in esc_path
Do not use esc_html in esc_path subroutine to avoid double quoting;
expand esc_html body (except quoting) in esc_path.

Move esc_path before quot_cec and quot_upr. Add some comments.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 01:45:26 -08:00
Junio C Hamano
7002243f7e gitweb: (style) use chomp without parentheses consistently.
It seems that gitweb tries to consistently use chomp without parentheses
around its operands, but there were two places that said "chomp($var);".

Let's be consistent.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 14:07:41 -08:00
Jakub Narebski
793c400cc1 gitweb: Replace SPC with &nbsp; also in tag comment
Commit messages had SPC replaced with &nbsp; entity;
make it so also in tag message (tag comment).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 14:01:23 -08:00
Jakub Narebski
897d1d2e2a gitweb: Finish restoring "blob" links in git_difftree_body
This finishes work started by commit 4777b0141a
  "gitweb: Restore object-named links in item lists"
by Petr Baudis. It brings back rest of "blob" links in difftree-raw
like part of "commit" and "commitdiff" views, namely in
git_difftree_body subroutine.

Now the td.link table cell has the following links:
 * link to diff ("blobdiff" view) in "commit" view, if applicable
   (there is no link to uninteresting creation/deletion diff), or
   link to patch anchor in "commitdiff" view.
 * link to current version of file ("blob" view), with the obvious
   exception of file deletion, where it is link to the parent
   version.
 * link to "blame" view, if it is enabled, and file was not just
   created (i.e. it has any history).
 * link to history of the file ("history" view), again with sole
   exception of the case of new file.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski
af6feeb229 gitweb: Refactor feed generation, make output prettier, add Atom feed
Add support for more modern Atom web feed format. Both RSS and Atom
feeds are generated by git_feed subroutine to avoid code duplication;
git_rss and git_atom are thin wrappers around git_feed. Add links to
Atom feed in HTML header and in page footer (but not in OPML; we
should use APP, Atom Publishing Proptocol instead).

Allow for feed generation for branches other than current (HEAD)
branch, and for generation of feeds for file or directory history.

Do not use "pre ${\sub_returning_scalar(...)} post" trick, but join
strings instead: "pre " . sub_returning_scalar(...) . " post".
Use href(-full=>1, ...) instead of hand-crafting gitweb urls.

Make output prettier:
* Use title similar to the title of web page
* Use project description (if exists) for description/subtitle
* Do not add anything (committer name, commit date) to feed entry title
* Wrap the commit message in <pre>
* Make file names into an unordered list
* Add links (diff, conditional blame, history) to the file list.

In addition to the above points, the attached patch emits a
Last-Changed: HTTP response header field, and doesn't compute the feed
body if the HTTP request type was HEAD. This helps keep the web server
load down for well-behaved feed readers that check if the feed needs
updating.

If browser (feed reader) sent Accept: header, and it prefers 'text/xml' type
to 'application/rss+xml' (in the case of RSS feed) or 'application/atom+xml'
(in the case of Atom feed), then use 'text/xml' as content type.

Both RSS and Atom feeds validate at http://feedvalidator.org
and at http://validator.w3.org/feed/

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Andreas Fuchs <asf@boinkor.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski
bd5d1e42fb gitweb: Add an option to href() to return full URL
href subroutine by default generates absolute URL (generated using
CGI::url(-absolute=>1), and saved in $my_uri) using $my_uri as base;
add an option to generate full URL using $my_url as base.

New feature usage: href(..., -full=>1)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski
59e3b14e08 gitweb: New improved formatting of chunk header in diff
If we have provided enough info, and diff is not combined diff,
and if provided diff line is chunk header, then:
* split chunk header into .chunk_info and .section span elements,
  first containing proper chunk header, second section heading
  (aka. which function), for separate styling: the proper chunk
  header is on non-white background, section heading part uses
  slightly lighter color.
* hyperlink from-file-range to starting line of from-file, if file
  was not created.
* hyperlink to-file-range to starting line of to-file, if file
  was not deleted.
Links are of invisible variety (and "list" class).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski
9954f772eb gitweb: Default to $hash_base or HEAD for $hash in "commit" and "commitdiff"
Set $hash parameter to $hash_base || "HEAD" if it is not set (if it is
not true to be more exact). This allows [hand-edited] URLs with 'action'
"commit" or "commitdiff" but without 'hash' parameter.

If there is 'h' (hash) parameter provided, then gitweb tries
to use this. HEAD is used _only_ if nether hash, nor hash_base
are provided, i.e. for URL like below
  URL?p=project.git;a=commit
i.e. without neither 'h' nor 'hb'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski
6d55f05576 gitweb: Buffer diff header to deal with split patches + git_patchset_body refactoring
There are some cases when one line from "raw" git-diff output (raw format)
corresponds to more than one patch in the patchset git-diff output. To deal
with this buffer git diff header and extended diff header (everything up to
actual patch) to check from information from "index <hash>..<hash>" extended
header line if the patch corresponds to the same or next difftree raw line.

This could also be used to gather information needed for hyperlinking, and
used for printing gitweb quoted filenames, from extended diff header instead
of raw git-diff output.

While at it, refactor git_patchset_body subroutine from the event-driven,
AWK-like state-machine parsing to sequential parsing: for each patch
parse (and output) git diff header, parse extended diff header, parse two-line
from-file/to-file diff header, parse patch itself; patch ends with the end
of input [file] or the line matching m/^diff /.

For better understanding the code, there were added assertions in the
comments a la Carp::Assert module. Just in case there is commented out code
dealing with unexpected end of input (should not happen, hence commented
out).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski
04408c3578 gitweb: Protect against possible warning in git_commitdiff
We may read an undef from <$fd> and unconditionally chomping it
would result in a warning.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Alexandre Julliard
faa1bbfdd2 gitweb: Put back shortlog instead of graphiclog in the project list.
Looks like a repo.or.cz-specific change slipped in.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-15 12:49:27 -08:00
Junio C Hamano
1c791cfbf8 gitweb: fix unmatched div in commitdiff
When the last filepair changed only metainfo we failed to close the
extended header <div>.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 02:33:35 -08:00
Junio C Hamano
225932ed4d gitweb: protect commit messages from controls.
The same change as the previous.  It is rather sad that commit log
message parser gives list of chomped lines while tag message parser
gives unchomped ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 00:57:13 -08:00
Junio C Hamano
25ffbb27a2 gitweb: protect blob and diff output lines from controls.
This revealed that the output from blame and tag was not chomped
properly and was relying on HTML output not noticing that extra
whitespace that resulted from the newline, which was also fixed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 00:13:50 -08:00
Junio C Hamano
2b2a8c78ea gitweb: do not give blame link unconditionally in diff-tree view
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-08 12:34:25 -08:00
Jakub Narebski
744d0ac33a gitweb: New improved patchset view
Replace "gitweb diff header" with its full sha1 of blobs and replace
it by "git diff" header and extended diff header. Change also somewhat
highlighting of diffs.

Added `file_type_long' subroutine to convert file mode in octal to
file type description (only for file modes which used by git).

Changes:
* "gitweb diff header" which looked for example like below:
    file:_<sha1 before>_ -> file:_<sha1 after>_
  where 'file' is file type and '<sha1>' is full sha1 of blob is
  changed to
    diff --git _a/<file before>_ _b/<file after>_
  In both cases links are visible and use default link style. If file
  is added, a/<file> is not hyperlinked. If file is deleted, b/<file>
  is not hyperlinked.
* there is added "extended diff header", with <path> and <hash>
  hyperlinked (and <hash> shortened to 7 characters), and <mode>
  explained: '<mode>' is extended to '<mode> (<file type description>)',
  where added text is slightly lighter to easy distinguish that it
  was added (and it is difference from git-diff output).
* from-file/to-file two-line header lines have slightly darker color
  than removed/added lines.
* chunk header has now delicate line above for easier finding chunk
  boundary, and top margin of 2px, both barely visible.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-08 12:34:19 -08:00
Jakub Narebski
1d3bc0cc0a gitweb: Use character or octal escape codes (and add span.cntrl) in esc_path
Instead of simply hiding control characters in esc_path by replacing
them with '?', use Character Escape Codes (CEC) i.e. alphabetic
backslash sequences like those found in C programming language and
many other languages influenced by it, such as Java and Perl.  If
control characted doesn't have corresponding character escape code,
use octal char sequence to escape it.

Alternatively, controls can be replaced with Unicode Control
Pictures U+2400 - U+243F (9216 - 9279), the Unicode characters
reserved for representing control characters when it is
necessary to print or display them.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-08 12:34:03 -08:00
Jakub Narebski
403d0906e9 gitweb: Better git-unquoting and gitweb-quoting of pathnames
Extend unquote subroutine, which unquotes quoted and escaped filenames
which git may return, to deal not only with octal char sequence
quoting, but also quoting ordinary characters including '\"' and '\\'
which are respectively quoted '"' and '\', and to deal also with
C escape sequences including '\t' for TAB and '\n' for LF.

Add esc_path subroutine for gitweb quoting and HTML escaping filenames
(currently it does equivalent of ls' --hide-control-chars, which means
showing undisplayable characters (including '\n' and '\t') as '?'
(question mark) character, and use 'span' element with cntrl CSS class
to help rendering them differently.

Convert gitweb to use esc_path correctly to print pathnames.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-08 10:38:48 -08:00
Junio C Hamano
83ee94c12c gitweb: minimally fix "fork" support.
A forked project is defined to be $projname/$forkname.git for
$projname.git; the code did not check this correctly and mistook
$projname/.git to be a fork of itself.  This minimally fixes the
breakage.

Also forks were not checked when index.aux file was in use.
Listing the forked ones in index.aux would show them also on the
toplevel index which may go against the hierarchical nature of
forks, but again this is a minimal fix to whip it in a better
shape suitable to be in the 'master' branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-07 22:42:05 -08:00
Junio C Hamano
5dd5ed09fe gitweb: fix disabling of "forks"
Apparently this code was never tested without "forks".  check-feature
returns a one-element list (0) when disabled, and assigning that to a
scalar variable made it to be called in a scalar context, which meant
my $check_forks = gitweb_check_feature("forks") were always 1!

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-07 22:00:45 -08:00
Junio C Hamano
9004dcbe82 Merge branch 'pb/web'
* pb/web:
  gitweb: Support for 'forks'
2006-11-04 17:13:38 -08:00
Aneesh Kumar K.V
6768d6b847 gitweb: Remove extra "/" in path names for git_get_project_list
Without this change we get a wrong $pfxlen value and the check_export_ok()
checks with with a wrong directory name. Without this patch the below
$projects_list fails with gitweb

$projects_list = "/tmp/a/b/";

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-04 01:51:35 -08:00
Jakub Narebski
6255ef08ae gitweb: Better support for non-CSS aware web browsers
Add option to replace SPC (' ') with hard (non-breakable) space HTML
entity '&nbsp;' in esc_html subroutine.

Replace ' ' with '&nbsp;' for the code/diff display part in git_blob
and git_patchset_body; this is to be able to view code and diffs in
web browsers which doesn't understand "white-space: pre;" CSS
declaration.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-02 23:13:37 -08:00
Jakub Narebski
241cc599b3 gitweb: Output also empty patches in "commitdiff" view
Remove skipping over empty patches (i.e. patches which consist solely
of extended headers) in git_patchset_body, and add links to those
header-only patches in git_difftree_body (but not generate blobdiff
links when there were no change in file contents).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-02 23:11:31 -08:00
Jakub Narebski
cd1464083c gitweb: Use git-for-each-ref to generate list of heads and/or tags
Add two subroutines: git_get_heads_list and git_get_refs_list, which
fill out needed parts of refs info (heads and tags respectively) info
using single call to git-for-each-ref, instead of using
git-peek-remote to get list of references and using parse_ref for each
ref to get ref info, which in turn uses at least one call of git
command.

Replace call to git_get_refs_list in git_summary by call to
git_get_references, git_get_heads_list and git_get_tags_list
(simplifying this subroutine a bit). Use git_get_heads_list in
git_heads and git_get_tags_list in git_tags. Modify git_tags_body
slightly to accept output from git_get_tags_list.

Remove no longer used, and a bit hackish, git_get_refs_list.
parse_ref is no longer used, but is left for now.

Generating "summary" and "tags" views should be much faster for
projects which have large number of tags.

CHANGES IN OUTPUT: Before, if ref in refs/tags was tag pointing to
commit we used committer epoch as epoch for ref, and used tagger epoch
as epoch only for tag pointing to object of other type. If ref in
refs/tags was commit, we used committer epoch as epoch for ref (see
parse_ref; we sorted in gitweb by 'epoch' field).

Currently we use committer epoch for refs pointing to commit objects,
and tagger epoch for refs pointing to tag object, even if tag points
to commit.

Simple ab benchmark before and after this patch for my git.git
repository (git/jnareb-git.git) with some heads and tags added
as compared to git.git repository, shows around 2.4-3.0 times speedup
for "summary" and "tags" views:

 summary   3134 +/- 24.2 ms  -->   1081 +/- 30.2 ms
 tags      2886 +/- 18.9 ms  -->   1196 +/- 15.6 ms

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-02 18:04:40 -08:00
Jakub Narebski
8b4b94cc79 gitweb: Use 's' regexp modifier to secure against filenames with LF
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>
2006-11-01 12:26:29 -08:00
Jakub Narebski
45bd0c808d gitweb: Secure against commit-ish/tree-ish with the same name as path
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>
2006-11-01 12:15:39 -08:00
Luben Tuikov
5ad0828ca3 gitweb: esc_html() author in blame
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>
2006-11-01 11:31:55 -08:00
Jakub Narebski
151602df00 gitweb: Add "next" link to commitdiff view
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>
2006-10-28 14:26:00 -07:00
Jakub Narebski
c60c56cc70 gitweb: Move git_get_last_activity subroutine earlier
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>
2006-10-28 14:26:00 -07:00
Petr Baudis
887a612fef gitweb: Fix up bogus $stylesheet declarations
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>
2006-10-27 17:15:41 -07:00
Junio C Hamano
019298015b Merge branch 'maint'
* 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
2006-10-27 02:16:18 -07:00
Jakub Narebski
d6b7e0b98f gitweb: Check git base URLs before generating URL from it
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>
2006-10-27 02:12:56 -07:00
Jakub Narebski
35f401a670 gitweb: Use --no-commit-id in git_commit and git_commitdiff
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>
2006-10-26 02:16:30 -07:00
Petr Baudis
e30496dfcb gitweb: Support for 'forks'
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>
2006-10-25 14:40:20 -07:00
Junio C Hamano
40eaac5abd Merge branch 'jc/web'
* 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
2006-10-25 13:30:18 -07:00
Junio C Hamano
8e95026f29 Merge branch 'jc/web-blame'
* 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.
2006-10-25 13:18:06 -07:00
Jakub Narebski
8256098399 gitweb: Print commit message without title in commitdiff only if there is any
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>
2006-10-24 21:36:42 -07:00
Jakub Narebski
62fae51dd5 gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
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>
2006-10-24 21:23:41 -07:00
Jakub Narebski
f2069411c9 gitweb: Get rid of git_print_simplified_log
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>
2006-10-24 21:16:44 -07:00
Petr Baudis
447ef09a5c gitweb: Show project's README.html if available
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>
2006-10-23 20:55:44 -07:00
Petr Baudis
8be2890c99 gitweb: Do not automatically append " git" to custom site name
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>
2006-10-23 20:55:41 -07:00
Petr Baudis
88ad729b73 gitweb: Make search type a popup menu
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>
2006-10-23 20:55:38 -07:00
Petr Baudis
4777b0141a gitweb: Restore object-named links in item lists
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>
2006-10-23 20:55:26 -07:00
Junio C Hamano
ccbb3d17ac Merge branch 'master' into jc/web
* 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.
  ...
2006-10-23 20:53:38 -07:00
Junio C Hamano
1259404c7e Merge branch 'maint'
* 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.
2006-10-23 19:29:05 -07:00
Petr Baudis
a153adf683 gitweb: Fix setting $/ in parse_commit()
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>
2006-10-23 19:21:05 -07:00
Jakub Narebski
b6b7fc7283 gitweb: Add '..' (up directory) to tree view if applicable
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>
2006-10-22 22:54:08 -07:00
Jakub Narebski
4df118ed60 gitweb: Improve git_print_page_path
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>
2006-10-22 22:54:08 -07:00
Junio C Hamano
02a20456d2 Merge branch 'maint'
* 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
2006-10-22 22:40:30 -07:00
Jakub Narebski
300454feab gitweb: Do not esc_html $basedir argument to git_print_tree_entry
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>
2006-10-22 13:24:37 -07:00
Jakub Narebski
e7fb022a42 gitweb: Whitespace cleanup - tabs are for indent, spaces are for align (2)
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>
2006-10-22 12:56:41 -07:00
Junio C Hamano
72bbc38b0a Merge branch 'mw/pathinfo'
* 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
2006-10-18 22:09:11 -07:00
Junio C Hamano
63e02a1be3 gitweb: use for-each-ref to show the latest activity across branches
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>
2006-10-15 03:29:09 -07:00
Junio C Hamano
48fd688ab0 gitweb: spell "blame --porcelain" with -p
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-12 00:47:03 -07:00
Petr Baudis
34c06118ed gitweb: Fix search form when PATH_INFO is enabled
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>
2006-10-11 14:42:22 -07:00
Luben Tuikov
d15c55aa05 gitweb: blame porcelain: lineno and orig lineno swapped
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 01:15:36 -07:00
Jakub Narebski
9a7a62ff71 gitweb: Cleanup Git logo and Git logo target generation
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>
2006-10-08 13:36:58 -07:00
Petr Baudis
45a3b12cfd gitweb: Document features better
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>
2006-10-07 23:12:12 -07:00
Petr Baudis
a144154f85 gitweb: [commit view] Do not suppress commitdiff link in root commit
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>
2006-10-07 02:19:17 -07:00
Petr Baudis
7e0fe5c939 gitweb: Handle commits with empty commit messages more reasonably
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>
2006-10-07 02:16:33 -07:00
Petr Baudis
689b7f5ccb gitweb: Separate (new) and (deleted) in commitdiff by a space
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>
2006-10-07 02:16:22 -07:00
Petr Baudis
55ff35cb64 Show snapshot link in shortlog only if have_snapsho
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-07 01:38:46 -07:00
Yasushi SHOJI
847abc0f2a gitweb: refactor decode() for utf8 conversion
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>
2006-10-06 02:56:50 -07:00
Junio C Hamano
eeef88cd20 gitweb: use blame --porcelain
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>
2006-10-06 00:16:09 -07:00
Junio C Hamano
4b4a5dbb17 Merge branch 'jc/blame' into jc/web-blame
* 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
2006-10-06 00:16:05 -07:00
Junio C Hamano
51a7c66a73 gitweb: Make the Git logo link target to point to the homepage
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>
2006-10-05 15:02:13 -07:00
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
Martin Waitz
a945591906 gitweb: warn if feature cannot be overridden.
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>
2006-10-04 23:02:31 -07:00
Alan Chandler
b2d3476e15 Gitweb - provide site headers and footers
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>
2006-10-04 15:00:49 -07:00
Luben Tuikov
c8aeaaf7fc gitweb: blame: Mouse-over commit-8 shows author and date
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-04 14:56:50 -07:00
Luben Tuikov
9dc5f8c9c2 gitweb: blame: print commit-8 on the leading row of a commit-block
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>
2006-10-04 14:56:13 -07:00
Junio C Hamano
9074484a2b Revert 954a618375
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>
2006-10-04 14:55:16 -07:00
Junio C Hamano
2172ce4b01 gitweb: prepare for repositories with packed refs.
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>
2006-10-03 02:30:47 -07:00
Junio C Hamano
954a618375 gitweb: make leftmost column of blame less cluttered.
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>
2006-10-03 01:10:03 -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
Martin Waitz
9e756904d0 gitweb: start to generate PATH_INFO URLs.
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>
2006-10-02 00:49:42 -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
Matthias Lederhofer
32f4aaccaa gitweb: export options
$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>
2006-09-17 02:41:58 -07:00
Matthias Lederhofer
7939fe44b8 gitweb: do not use 'No such directory' error message
undef $project; to prevent a file named description to be read.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17 02:41:50 -07:00
Martin Waitz
800764cf33 gitweb: fix uninitialized variable warning.
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>
2006-09-17 01:58:56 -07:00
Martin Waitz
dd70235f5a gitweb: more support for PATH_INFO based URLs
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>
2006-09-17 01:54:13 -07:00
Jakub Narebski
9d0734ae49 gitweb: Add link to "project_index" view to "project_list" page
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>
2006-09-16 02:04:24 -07:00
Jakub Narebski
a1565c447d gitweb: Allow for href() to be used for links without project param
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>
2006-09-16 02:03:11 -07:00
Jakub Narebski
fc2b2be031 gitweb: Add git_project_index for generating index.aux
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>
2006-09-14 22:54:40 -07:00
Jakub Narebski
c83a77e4e1 gitweb: Do not parse refs by hand, use git-peek-remote instead
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>
2006-09-14 22:41:13 -07:00
Jakub Narebski
c0011ff8c8 gitweb: Use File::Find::find in git_get_projects_list
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>
2006-09-14 22:38:19 -07:00
Jakub Narebski
8be683520e gitweb: Paginate history output
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>
2006-09-10 19:33:09 -07:00
Jakub Narebski
04f7a94f65 gitweb: Make pickaxe search a feature
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>
2006-09-10 19:32:58 -07:00
Jakub Narebski
762c7205f6 gitweb: Divide page path into directories -- path's "breadcrumbs"
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>
2006-09-04 15:46:44 -07:00
Jakub Narebski
72dbafa1e6 gitweb: Correct typo: '==' instead of 'eq' in git_difftree_body
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:46:32 -07:00
Jakub Narebski
0b5deba132 gitweb: Add GIT favicon, assuming image/png type
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:33:04 -07:00
Jakub Narebski
f2e609473c gitweb: Change the name of diff to parent link in "commit" view to "diff
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>
2006-09-03 16:15:11 -07:00
Aneesh Kumar K.V
1d3fc68ae7 gitweb: Fix git_blame
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 21:10:17 -07:00
Jakub Narebski
0edcb37d67 gitweb: Extend parse_difftree_raw_line to save commit info
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>
2006-08-31 12:58:31 -07:00
Jakub Narebski
fa702003e4 gitweb: Separate printing of git_tree row into git_print_tree_entry
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>
2006-08-31 12:58:07 -07:00
Jakub Narebski
cb849b46ac gitweb: Move git-ls-tree output parsing to parse_ls_tree_line
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>
2006-08-31 12:57:52 -07:00
Dennis Stosberg
4b5dc988c0 use do() instead of require() to include configuration
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>
2006-08-31 12:57:08 -07:00
Dennis Stosberg
3a36bc8469 gitweb: Remove forgotten call to git_to_hash
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>
2006-08-31 12:48:37 -07:00
Jakub Narebski
a44465ccd9 gitweb: Add local time and timezone to git_print_authorship
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>
2006-08-28 16:44:14 -07:00
Jakub Narebski
b4657e7759 gitweb: Add diff tree, with links to patches, to commitdiff view
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>
2006-08-28 16:21:35 -07:00
Jakub Narebski
fba20b429a gitweb: git_print_log: signoff line is non-empty line
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>
2006-08-28 16:21:35 -07:00
Jakub Narebski
6fd92a28eb gitweb: Add author information to commitdiff view
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>
2006-08-28 16:21:34 -07:00
Jakub Narebski
d50a9398fe gitweb: Do not remove signoff lines in git_print_simplified_log
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>
2006-08-28 16:21:34 -07:00
Jakub Narebski
b7f9253df9 gitweb: Make git_print_log generic; git_print_simplified_log uses it
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>
2006-08-28 16:21:34 -07:00
Dennis Stosberg
25691fbe6d gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}
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>
2006-08-28 16:21:34 -07:00
Jakub Narebski
6bcf4b46c9 gitweb: Use @diff_opts, default ('M'), as git-diff and git-diff-tree paramete
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>
2006-08-27 15:35:01 -07:00
Jakub Narebski
0aea33762b gitweb: Remove git_to_hash function
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>
2006-08-27 15:19:28 -07:00
Jakub Narebski
023782bd4d gitweb: Remove unused git_get_{preceding,following}_references
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>
2006-08-27 15:15:27 -07:00
Jakub Narebski
c8a99d7674 gitweb: Fix typo in git_patchset_body
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 15:12:10 -07:00
Jakub Narebski
090525541f gitweb: Fix typo in git_difftree_body
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 17:56:49 -07:00
Jakub Narebski
f2e7330299 gitweb: blobs defined by non-textual hash ids can be cached
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 13:56:09 -07:00
Jakub Narebski
17848fc67c gitweb: Improve comments about gitweb features configuration
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 13:52:57 -07:00
Jakub Narebski
73c9083f52 gitweb: Remove workaround for git-diff bug fixed in f82cd3c
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>
2006-08-26 12:26:42 -07:00
Junio C Hamano
b4c27c186f Merge branch 'master' into gl/web
* 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.
  ...
2006-08-26 01:08:39 -07:00
Jakub Narebski
030b52087f gitweb: git_annotate didn't expect negative numeric timezone
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 00:59:29 -07:00
Jakub Narebski
903acca753 gitweb: Remove creating directory for temporary files
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>
2006-08-25 19:42:34 -07:00
Jakub Narebski
8cce8e3ddb gitweb: Remove git_diff_print subroutine
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>
2006-08-25 19:42:33 -07:00
Jakub Narebski
9b71b1f6b3 gitweb: git_blobdiff_plain is git_blobdiff('plain')
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>
2006-08-25 19:42:24 -07:00
Jakub Narebski
7c5e2ebb5d gitweb: Use git-diff-tree or git-diff patch output for blobdiff
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>
2006-08-25 19:42:07 -07:00
Jakub Narebski
990dd0de51 gitweb: Change here-doc back for style consistency in git_blobdiff
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:41:18 -07:00
Jakub Narebski
c2c8ff2438 gitweb: Always display link to blobdiff_plain in git_blobdiff
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:41:15 -07:00
Jakub Narebski
ef10ee877f gitweb: Add invisible hyperlink to from-file/to-file diff header
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>
2006-08-25 19:41:12 -07:00
Jakub Narebski
e4e4f82545 gitweb: Parse two-line from-file/to-file diff header in git_patchset_body
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>
2006-08-25 19:41:09 -07:00
Jakub Narebski
fe87585e53 gitweb: Allow for pre-parsed difftree info in git_patchset_body
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>
2006-08-25 19:41:05 -07:00
Jakub Narebski
420e92f255 gitweb: Add support for hash_parent_base parameter for blobdiffs
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>
2006-08-25 19:40:25 -07:00
Jakub Narebski
edf735abfa gitweb: Use git_get_name_rev_tags for commitdiff_plain X-Git-Tag: header
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>
2006-08-25 19:40:10 -07:00