1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 23:07:55 +01:00
Commit graph

44 commits

Author SHA1 Message Date
Martin Waitz
6132b7e4bb gitweb: support for / as home_link.
If the webserver is configured to use gitweb even for the root directory
of the site, then my_uri is empty which leads to a non-functional home
link.  Fix that by defaulting to "/" in this case.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 03:04:46 -07:00
Martin Waitz
5c95fab017 gitweb: support for "fp" parameter.
The "fp" (file name parent) parameter was previously generated for
blob diffs of renamed files.  However, it was not used in any code.

Now href() can generate "fp" parameters and they are used by the
blobdiff code to show the correct file name.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 03:04:46 -07:00
Martin Waitz
756d2f064b gitweb: continue consolidation of URL generation.
Further use href() instead of URL generation by string concatenation.
Almost all functions are converted now.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 03:04:46 -07:00
Jakub Narebski
d4baf9eaf4 gitweb: Uniquify version info output, add meta generator in page header
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 03:04:38 -07:00
Jakub Narebski
e79ca7cc25 gitweb: Add support for per project git URLs
It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.

If there is no cloneurl file, concatenation of git base URLs with
project name is used.

This is merge of Jakub Narebski and David Rientjes
  gitweb: Show project's git URL on summary page
with Aneesh Kumar
  gitweb: Add support for cloneurl.
  gitweb: Support multiple clone urls
patches.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-16 13:37:40 -07:00
Martin Waitz
1c2a4f5add gitweb: consolidate action URL generation.
Use the href() function instead of string concatenation to generate
most URLs to our own CGI.
This is a work in progress, not everything has been converted yet.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:55:19 -07:00
Martin Waitz
06a9d86b49 gitweb: provide function to format the URL for an action link.
Provide a new function which can be used to generate an URL for the CGI.
This makes it possible to consolidate the URL generation in order to make
it easier to change the encoding of actions into URLs.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:55:17 -07:00
Jakub Narebski
19a8721ef8 gitweb: Show project's git URL on summary page
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
Date: Tue, 15 Aug 2006 11:43:04 -0700
Subject: [PATCH] gitweb: Show project's git URL on summary page

Add support for showing multiple clone/fetch git URLs for project on
a summary page. URL for project is created from base URL and project
name.

For example for XMMS2 project (xmms.se) the git base URL would be
git://git.xmms.se/xmms2.

With corrections from David Rientjes <rientjes@google.com>

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:54:26 -07:00
Yasushi SHOJI
2de21fac98 gitweb: configurable home link string
I've always found difficult to figure out git URL for clone from
gitweb URL because git:// and http:// are different on many site
including kernel.org.

I've found this enhancement at http://dev.laptop.org/git when I was on
git channel, and thought that it'd be nice if all public gitweb site
show it's git URL on its page.

This patch allow us to change the home link string.  The current
default is "projects" as we all see on gitweb now.

ie. kernel.org might set this variable to "git://git.kernel.org/pub/scm/"

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 18:09:33 -07:00
Jakub Narebski
4a4a1a53d1 gitweb: Separate printing difftree in git_commit into git_difftree_body
Separate printing difftree in git_commit into separate
git_difftree_body subroutine. Add support for "C" (copied) status. For
"M" and "C" add parameter 'fp' (filename parent) to the "diff" link;
currently not supported by git_blobdiff ("blobdiff" action).

Reindented, realigned, added comments.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:40:50 -07:00
Jakub Narebski
d5aa50de62 gitweb: True fix: Support for the standard mime.types map in gitweb
True fix for error in mimetype_guess, error introduced in original commit
2d00737489 and later fixed temporarily
by commenting out the line that caused error in commit
57bd4d3523.

Gitweb now supports mime.types map $mimetypes_file relative to project.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:33:19 -07:00
Jakub Narebski
618918e541 gitweb: Skip comments in mime.types like file
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:30:16 -07:00
Jakub Narebski
d294e1cad4 gitweb: Change appereance of marker of refs pointing to given object
Change git_get_references to include type of ref in the %refs value, which
means putting everything after 'refs/' as a ref name, not only last
part of the name.  Instead of separating refs pointing to the same
object by " / " separator, use anonymous array reference to store all
refs pointing to given object.

Use 'git-ls-remote .' if $projectroot/$project/info/refs does not
exist.  (Perhaps it should be used always.)

Refs are now in separate span elements.  Class is dependent on the ref
type: currently known classes are 'tag', 'head', 'remote', and 'ref'
(last one for HEAD and other refs in the main directory).  There is
encompassing span element of class refs, just in case of unknown ref
type.

This might be considered cleaner separating of git_get_references into
filling %refs hash only, and not taking part in formatting ref marker.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:28:01 -07:00
Jakub Narebski
1e0cf030c0 gitweb: Separate finding project owner into git_get_project_owner
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:10:52 -07:00
Jakub Narebski
581860e1b8 gitweb: Separate main part of git_history into git_history_body
Separates main part of git_history into git_history_body subroutine,
and makes output more similar to git_shortlog.  Adds "diff to current"
link only for history of regular file (blob).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:03:20 -07:00
Jakub Narebski
17d0744318 gitweb: Refactor printing shortened title in git_shortlog_body and git_tags_body
Separate printing of perhaps shortened title (subject) in
git_shortlog_body and git_tags_body into format_subject_html.

While at it, remove presentation element <b>...</b> used to format
title (subject) and move formatting to CSS.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 17:02:42 -07:00
Jakub Narebski
a446d6bb53 gitweb: Separate ref parsing in git_get_refs_list into parse_ref
Note that for each ref there are usually two calls to git subroutines:
first to get the type of ref, second to parse ref if ref is of commit
or tag type.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 16:56:10 -07:00
Jakub Narebski
847e01fb00 gitweb: Great subroutines renaming
Rename some of subroutines to better reflect what they do.
Some renames were not performed because subroutine name
reflects hash key.

Subroutines name guideline:
* git_ prefix for subroutines related to git commands,
  git repository, or to gitweb actions
* git_get_ prefix for inner subroutines calling git command
  or reading some file in the repository and returning some output
* parse_ prefix for subroutines parsing some text (or reading and
  parsing some text) into hash or list
* format_ prefix for subroutines formatting, post-processing
  or generating some HTML/text fragment
* _get_ infix for subroutines which return result
* _print_ infix for subroutines which print fragment of output
* _body suffix for subroutines which outputs main part (body)
  of related action (usually table)
* _nav suffix for subroutines related to navigation bars
* _div suffix for subroutines returning or printing div element
* subroutine names should not be based on how the result is obtained,
  as this might change easily

Renames performed:
- git_get_referencing => format_ref_marker
- git_get_paging_nav => format_paging_nav
- git_read_head => git_get_head_hash
- git_read_hash => git_get_hash_by_ref
- git_read_description => git_get_project_description
- git_read_projects => git_get_projects_list
- read_info_ref => git_get_references
- git_read_refs => git_get_refs_list
- date_str => parse_date
- git_read_tag => parse_tag
- git_read_commit => parse_commit
- git_blob_plain_mimetype => blob_mimetype
- git_page_nav => git_print_page_nav
- git_header_div => git_print_header_div

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 16:29:28 -07:00
Junio C Hamano
6295ac347a Merge branch 'jn/web' 2006-08-12 19:24:15 -07:00
Jakub Narebski
26298b5f7b gitweb: Whitespace cleanup - 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-08-10 14:30:28 -07:00
Luben Tuikov
82f930dead gitweb: blame table row no highlight fix
Until now blame just used the commit/tree/tags/etc style of
highlight-able table rows, which have alternating light/dark rows that
flash when mouse pointer passes over them. This is very annoying in
blame, since the text is static and it interferes with the
per-revision block highlighting.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-07 18:15:29 -07:00
Luben Tuikov
d636ad9743 gitweb: bugfix: git_commit and git_commitdiff parents
In git_commit() the hash base of $from_id is $parent, not
$hash:
 - If status is "D", then action blob for $from_id wants
   $parent, not $hash.  History needs $parent too.
 - If status is "R", then action blob for $from_id wants
   $parent, not $hash.

Similarly in git_commitdiff() the hash base of $from_id is
$hash_parent, not $hash.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-07 18:15:29 -07:00
Jakub Narebski
f1efc38bf2 gitweb: Remove unused variables in git_shortlog_body and git_heads
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-07 17:29:40 -07:00
Matthias Lederhofer
dd04c428cf gitweb: fix $project usage
There were some places where $project was used even if it was not
defined.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:50:43 -07:00
Matthias Lederhofer
1568515d5b gitweb: fix commitdiff_plain for root commits
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:42:41 -07:00
Jakub Narebski
e349d21ab4 gitweb: Skip nonmatching lines in difftree output, consistently
This fixes error for commitdiff on root commit (without parents).

Noticed-by: Matthias Lederhofer (matled)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:42:39 -07:00
Jakub Narebski
b5ff2cf9a6 gitweb: fix commitdiff for root commits
After changing all "-|" open invocations to list form, commitdiff for
initial commit (without parent) got broken; it returned incorrectly
empty patch earlier.  Use '--root' option to git-diff-tree for initial
(root) commit.

No checking for empty $hash_parent in git_commitdiff_plain -- we rely
on gitweb to give correct parameters for commitdiff_plain action.

Noticed by Matthias Lederhofer (matled).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:41:49 -07:00
Matthias Lederhofer
bd943f4757 gitweb: check if HTTP_ACCEPT is really set
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:40:19 -07:00
Jakub Narebski
f16db173a4 gitweb: Refactor untabifying - converting tabs to spaces
Add untabify subroutine and use it.  It also fixes git_diff_print
which used to get the tabstop wrong.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 02:00:32 -07:00
Jakub Narebski
10161355ba gitweb: Inline $rss_link
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 02:00:32 -07:00
Jakub Narebski
668e34d7cc gitweb: PATH_INFO=/ means no project
Prepared for refactoring input validation.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:59:45 -07:00
Jakub Narebski
e2860ead31 gitweb: No error messages with unescaped/unprotected user input
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:59:36 -07:00
Jakub Narebski
cac4bd94fb gitweb: No periods for error messages
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:58:21 -07:00
Jakub Narebski
e484a2d6ad gitweb: Cleanup and uniquify error messages
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:53:54 -07:00
Jakub Narebski
dbd954a896 gitweb: Don't undefine query parameter related variables before die_error
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:53:38 -07:00
Jakub Narebski
623e4aeb42 gitweb: Use undef for die_error to use default first (status) parameter value
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:53:26 -07:00
Jakub Narebski
cfd8266936 gitweb: die_error first (optional) parameter is HTTP status
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:53:16 -07:00
Jakub Narebski
154b4d78cf gitweb: Separate input validation and dispatch, add comment about opml action
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:52:51 -07:00
Luben Tuikov
f9f02d0129 gitweb: git_tree displays blame based on repository config
git_tree() will now conditionally display "blame"
depending on how "gitweb.blame" variable is configured
using "git-repo-config".

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-04 17:21:41 -07:00
Junio C Hamano
06c084d28b gitweb: do not use @@FOO@@ for replaced tokens
This makes it easier to run gitweb/gitweb.perl without token substitution.
Using @@ makes Perl emit "unintended interpolation" warnings.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 13:58:04 -07:00
Matthias Lederhofer
bb55f77fcd gitweb: require $ENV{'GITWEB_CONFIG'}
With this patch it is possible to use gitweb.perl for developing by
loading the configuration from $GITWEB_CONFIG.  This might also be
useful for normal usage of gitweb.

Example:

    % cat cfg
    $GIT = '/usr/bin/git';
    $projectroot = '/home/matled/src/git';
    $projects_list = '/home/matled/src/git/git/gitweb/list';
    % cat run
    #!/bin/sh
    export GATEWAY_INTERFACE="CGI/1.1"
    export HTTP_ACCEPT="*/*"
    export REQUEST_METHOD="GET"
    export GITWEB_CONFIG='./cfg'
    export QUERY_STRING=""$1""
    exec ./gitweb.perl
    % time ./run p=git/.git > /dev/null

This makes it easy to check for warnings and do performance tests
after changes, you can also pipe this to lynx -dump -force-html
/dev/stdin to get more than just html.

This also documents the original patch adding require $GITWEB_CONFIG.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 13:56:34 -07:00
Jeff King
c8d138a8c0 gitweb: optionally read config from GITWEB_CONFIG
Configuration will first be taken from variables inside the gitweb.cgi
script, which in turn come from the Makefile. Afterwards, the contents of
GITWEB_CONFIG are read, overriding the builtin defaults.

This should eliminate the need for editing the gitweb script at all. Users
should edit the Makefile and/or add a config file.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 13:56:34 -07:00
Martin Waitz
281f2f6b45 gitweb: use out-of-line GIT logo.
Use the normal web server instead of the CGI to provide the git logo,
just like the gitweb.css.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-01 15:55:19 -07:00
Martin Waitz
5d043a3d85 gitweb: fill in gitweb configuration by Makefile
Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi
by the end user.  The GIT installation directory is already known
by the Makefile, and can be inserted directly into gitweb.
All other gitweb configuration parameters can now be specified by
providing GITWEB_* variables while building GIT.  These are described
in gitweb/README.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-01 15:44:47 -07:00
Renamed from gitweb/gitweb.cgi (Browse further)