Commit Graph

5772 Commits

Author SHA1 Message Date
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
Matthias Kestenholz
403ccc4f36 Add gitweb.cgi to .gitignore
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 13:38:14 -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
Junio C Hamano
22987ae0bc Makefile: gitweb/gitweb.cgi is now generated.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-01 16:23:47 -07:00
Junio C Hamano
ee0d3234b1 gitweb/README: do not bug Kay with gitweb questions anymore
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-01 15:56:28 -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
Jakub Narebski
6326b60cfd gitweb: Refactoring git_project_list
Slightly reworking git_project_list, including moving setting $order,
as it is used only in this action. Mostly reindent.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 21:12:36 -07:00
Junio C Hamano
5d1acf4da0 gitweb: avoid undefined value warning in print_page_path
The function unconditionally tried to match $type but some
callers did not pass it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 21:00:58 -07:00
Junio C Hamano
498934a7e5 gitweb: when showing history of a tree, show tree link not blob
Otherwise clicking on that erroneous blob link would produce nonsense.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 19:36:50 -07:00
Junio C Hamano
46b059d718 gitweb: fix use of uninitialized value.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 19:24:37 -07:00
Junio C Hamano
b77aeb249a gitweb: an obvious cut and paste error.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 19:22:04 -07:00
Junio C Hamano
7a13b999a5 gitweb: There can be more than two levels of subdirectories
Earlier code to read .git/refs/{tags,heads} hierarchy had a
hardcoded up-to-two-level assumption.  Lift it by using
File::Find.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 19:21:38 -07:00
Matthias Lederhofer
8e85cdc4ef gitweb: use a hash to lookup the sub for an action
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 15:52:49 -07:00
Jakub Narebski
717b831178 gitweb: Reordering code and dividing it into categories
Reorder gitweb code around, divide it into sections (categories) and
add some comments.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 12:28:52 -07:00
Jakub Narebski
0349b46509 gitweb: Remove characters entities entirely when shortening string -- correction
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 12:08:41 -07:00
Jakub Narebski
822c185907 gitweb: do not quote path for list version of open "-|"
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 12:08:29 -07:00
Jakub Narebski
9f5dcb8168 gitweb: Refactor generation of shortlog, tags and heads body
Add git_shortlog_body, git_tags_body and git_heads_body to generate
table with shortlog, tags and heads respectively in git_summary and
git_shortlog, git_tags, git_heads respectively.

Better support for lightweight tags in git_read_refs; currently only
lightweight tag pointing to tag object is not resolved fully.

Shortlog, tags and heads body tables have proper class now (we could
use id instead of class).

Add support for showing full comment on mouseover to tags list when
comment is shortened, similar to how full title of commit was/is
shown on mouseover when title was shortened.  Changed layout of tags
table to better show lightweight tags.

Add showing which branch (head) is current branch (current head),
using "current_head" class (we could use id instead).

Corrected "</table\n>" and hit_header_div instead of git_header_div.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 03:09:28 -07:00
Jakub Narebski
594e212bc8 gitweb: Ref refactoring - use git_get_referencing for marking tagged/head commits
Use git_get_referencing to get HTML code for markers showing which
refs (tags and heads) point to current commit.  It would be much
easier to change format of markers in one or two places than thorough
the gitweb.cgi file.

Added comment about read_info_ref subroutine: for $type == "" (empty
argument) it saves only last path part of ref name e.g. from
'refs/heads/jn/gitweb' it would leave only 'gitweb'.

Some reordering.  Added $ref in one place.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:43:28 -07:00
Jakub Narebski
7ca84b5062 gitweb: Remove characters entities entirely when shortening string
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:42:33 -07:00
Jakub Narebski
27fb8c40c6 gitweb: Headers refactoring - use git_header_div for header divs
Add git_header_div subroutine which prints "header" divs, now with
class "header" (class "title" is taken, and has set CSS style,
changing appereance and maing layout wrong), and use it thorough
gitweb.cgi.  Change header linking to project summary from empty
(&nbsp; as a contents of link) to having $project as contents/name
of link.  Sometimes a little reordering.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:42:27 -07:00
Jakub Narebski
6855f42ecd gitweb: Remove $project from git_get_paging_nav arguments
Remove $project from arguments passed to git_get_paging_nav
subroutine: it did not depend only on arguments, using $my_uri global
variable (and now $project global variable).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:41:41 -07:00
Jakub Narebski
43ffc06d98 gitweb: Pager refactoring - use git_get_paging_nav for pagination
Add git_get_paging_nav subroutine which returns string with pager
(paging nav) for shortlog and log actions.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:41:26 -07:00
Jakub Narebski
898a893fc9 gitweb: Add "\n" after <br/> in git_page_nav
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:41:00 -07:00
Jakub Narebski
7d91010df4 gitweb: Show project descriptions with utf-8 characters in project list correctly
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:40:49 -07:00
Jakub Narebski
3dc1383290 gitweb: Replace form-feed character by ^L
From 2be5cab10486cba804ccae063e93b146288054fe Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sun, 30 Jul 2006 13:11:56 +0200
Subject: [PATCH]

Replace FORM FEED (FF) character (014, 12, 0xc) by it's textual
representation '^L'.  This character is used for example in GNU GPL
'COPYING' file.  With this patch "blob" output for COPYING passes
XHTML validation.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:40:15 -07:00
Jakub Narebski
0d83ddc40f gitweb: Navbar refactoring - use git_page_nav to generate navigation bar
Use git_page_nav subroutine to generate navigation bar.  Additional
navigation (either formats or pager/pagination) is put into variables.

Corrects error in git_search where hash parameter was added to
"summary" link instead of to "log" link.  Might differ from previous
version by additional "<br/>" in navigation bar.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:39:36 -07:00
Jakub Narebski
b18f9bf462 gitweb: Add git_page_nav for later use
Adds git_page_nav subroutine to factor out the generation of the
navigation bar.  Based on Sven Verdoolaege code

  Message-Id: <20050618113121.GA13122@pc117b.liacs.nl>
  http://marc.theaimsgroup.com/?l=git&m=111909432415478&w=2

I tried for the refactored navbar generate the same result.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:38:17 -07:00
Jakub Narebski
0881d2d130 gitweb: Cleanup - chomp @lines in consistent style
Use 'my @lines = map { chomp; $_ } <$fd>;' form to read all lines of
git command output into array without trailing newlines.

It has advantage over 'chomp (my (@lines) = <$fd>);' in that it does
not modify array.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:37:29 -07:00
Jakub Narebski
cefda27f74 gitweb: Cleanup - chomp $line in consistent style
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:35:21 -07:00
Jakub Narebski
044bfdc8cb gitweb: More explicit error messages for open "-|"
Use more explicit error messages when failing magical "-|" open,
stating at least the name of the git command that failed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:34:47 -07:00
Jakub Narebski
dda754f7d4 gitweb: simplify git_get_hash_by_path
Simplify git_get_hash_by_path by using git-ls-tree to do path
limiting, instead of finding correct ttree and parsing unconstrained
git-ls-tree output.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:30:10 -07:00
Jakub Narebski
b9182987a8 gitweb: Use list for of open for running git commands, thorougly.
Use list form of open for running git commands and reading their
output through pipe, for example

	open my $fd, "-|", $GIT, "rev-list", "--header", "--parents", $hash

instead of

	open my $fd, "-|", "$GIT rev-list --header --parents $hash"

Single letter options use ' instead of " as quotes, according to style
used in list form of magic "-|" open.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:28:34 -07:00
Jakub Narebski
5be01bc8d5 gitweb: whitespace cleanup
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:21:28 -07:00
Johannes Schindelin
b63fafdfd8 tar-tree: illustrate an obscure feature better
Since you can tar just a subdirectory of a certain revision, tell
the users so, by showing an example how to do it.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 18:18:13 -07:00
Matthias Lederhofer
0347a8c764 git.c: allow alias expansion without a git directory
With this, the configuration mechanism can be used to say:

	[alias]
		init = init-db --template=/path/to/template

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 17:45:57 -07:00
Matthias Lederhofer
41e95f6990 setup_git_directory_gently: do not barf when GIT_DIR is given.
Earlier we barfed when GIT_DIR environment variable points at a
directory yet to be created, which made it impossible to use
configuration mechanism in "git-init-db".

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 17:45:57 -07:00