Code

git.git
18 years agogitweb: Remove unused variables in git_shortlog_body and git_heads
Jakub Narebski [Mon, 7 Aug 2006 23:15:05 +0000 (01:15 +0200)]
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>
18 years agogitweb: fix $project usage
Matthias Lederhofer [Sun, 6 Aug 2006 11:25:41 +0000 (13:25 +0200)]
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>
18 years agogitweb: fix commitdiff_plain for root commits
Matthias Lederhofer [Sun, 6 Aug 2006 17:24:47 +0000 (19:24 +0200)]
gitweb: fix commitdiff_plain for root commits

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Skip nonmatching lines in difftree output, consistently
Jakub Narebski [Sun, 6 Aug 2006 15:59:52 +0000 (17:59 +0200)]
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>
18 years agogitweb: fix commitdiff for root commits
Jakub Narebski [Sun, 6 Aug 2006 14:14:25 +0000 (16:14 +0200)]
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>
18 years agogitweb: check if HTTP_ACCEPT is really set
Matthias Lederhofer [Sun, 6 Aug 2006 13:55:02 +0000 (15:55 +0200)]
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>
18 years agoAdd gitweb.cgi to .gitignore
Matthias Kestenholz [Sun, 6 Aug 2006 10:47:33 +0000 (12:47 +0200)]
Add gitweb.cgi to .gitignore

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Refactor untabifying - converting tabs to spaces
Jakub Narebski [Sun, 6 Aug 2006 00:08:31 +0000 (02:08 +0200)]
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>
18 years agogitweb: Inline $rss_link
Jakub Narebski [Sat, 5 Aug 2006 11:18:58 +0000 (13:18 +0200)]
gitweb: Inline $rss_link

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: PATH_INFO=/ means no project
Jakub Narebski [Sat, 5 Aug 2006 11:16:03 +0000 (13:16 +0200)]
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>
18 years agogitweb: No error messages with unescaped/unprotected user input
Jakub Narebski [Sat, 5 Aug 2006 11:15:24 +0000 (13:15 +0200)]
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>
18 years agogitweb: No periods for error messages
Jakub Narebski [Sat, 5 Aug 2006 11:13:53 +0000 (13:13 +0200)]
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>
18 years agogitweb: Cleanup and uniquify error messages
Jakub Narebski [Sat, 5 Aug 2006 11:12:51 +0000 (13:12 +0200)]
gitweb: Cleanup and uniquify error messages

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Don't undefine query parameter related variables before die_error
Jakub Narebski [Sat, 5 Aug 2006 10:58:06 +0000 (12:58 +0200)]
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>
18 years agogitweb: Use undef for die_error to use default first (status) parameter value
Jakub Narebski [Sat, 5 Aug 2006 10:56:42 +0000 (12:56 +0200)]
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>
18 years agogitweb: die_error first (optional) parameter is HTTP status
Jakub Narebski [Sat, 5 Aug 2006 10:56:04 +0000 (12:56 +0200)]
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>
18 years agogitweb: Separate input validation and dispatch, add comment about opml action
Jakub Narebski [Sat, 5 Aug 2006 10:55:20 +0000 (12:55 +0200)]
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>
18 years agogitweb: git_tree displays blame based on repository config
Luben Tuikov [Fri, 4 Aug 2006 22:14:27 +0000 (15:14 -0700)]
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>
18 years agogitweb: do not use @@FOO@@ for replaced tokens
Junio C Hamano [Wed, 2 Aug 2006 20:50:20 +0000 (13:50 -0700)]
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>
18 years agogitweb: require $ENV{'GITWEB_CONFIG'}
Matthias Lederhofer [Wed, 2 Aug 2006 20:29:36 +0000 (22:29 +0200)]
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>
18 years agogitweb: optionally read config from GITWEB_CONFIG
Jeff King [Wed, 2 Aug 2006 19:23:34 +0000 (15:23 -0400)]
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>
18 years agoMakefile: gitweb/gitweb.cgi is now generated.
Junio C Hamano [Tue, 1 Aug 2006 23:23:47 +0000 (16:23 -0700)]
Makefile: gitweb/gitweb.cgi is now generated.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb/README: do not bug Kay with gitweb questions anymore
Junio C Hamano [Tue, 1 Aug 2006 22:56:28 +0000 (15:56 -0700)]
gitweb/README: do not bug Kay with gitweb questions anymore

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: use out-of-line GIT logo.
Martin Waitz [Sun, 30 Jul 2006 22:38:39 +0000 (00:38 +0200)]
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>
18 years agogitweb: fill in gitweb configuration by Makefile
Martin Waitz [Tue, 1 Aug 2006 19:34:08 +0000 (21:34 +0200)]
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>
18 years agogitweb: Refactoring git_project_list
Jakub Narebski [Tue, 1 Aug 2006 00:59:12 +0000 (02:59 +0200)]
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>
18 years agogitweb: avoid undefined value warning in print_page_path
Junio C Hamano [Tue, 1 Aug 2006 04:00:16 +0000 (21:00 -0700)]
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>
18 years agogitweb: when showing history of a tree, show tree link not blob
Junio C Hamano [Tue, 1 Aug 2006 02:36:50 +0000 (19:36 -0700)]
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>
18 years agogitweb: fix use of uninitialized value.
Junio C Hamano [Tue, 1 Aug 2006 02:24:37 +0000 (19:24 -0700)]
gitweb: fix use of uninitialized value.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: an obvious cut and paste error.
Junio C Hamano [Tue, 1 Aug 2006 02:12:18 +0000 (19:12 -0700)]
gitweb: an obvious cut and paste error.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: There can be more than two levels of subdirectories
Junio C Hamano [Tue, 1 Aug 2006 02:18:34 +0000 (19:18 -0700)]
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>
18 years agogitweb: use a hash to lookup the sub for an action
Matthias Lederhofer [Mon, 31 Jul 2006 21:46:25 +0000 (23:46 +0200)]
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>
18 years agogitweb: Reordering code and dividing it into categories
Jakub Narebski [Mon, 31 Jul 2006 19:22:15 +0000 (21:22 +0200)]
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>
18 years agogitweb: Remove characters entities entirely when shortening string -- correction
Jakub Narebski [Mon, 31 Jul 2006 18:58:00 +0000 (20:58 +0200)]
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>
18 years agogitweb: do not quote path for list version of open "-|"
Jakub Narebski [Mon, 31 Jul 2006 16:33:37 +0000 (18:33 +0200)]
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>
18 years agogitweb: Refactor generation of shortlog, tags and heads body
Jakub Narebski [Mon, 31 Jul 2006 09:22:13 +0000 (11:22 +0200)]
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>
18 years agogitweb: Ref refactoring - use git_get_referencing for marking tagged/head commits
Jakub Narebski [Mon, 31 Jul 2006 00:21:52 +0000 (02:21 +0200)]
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>
18 years agogitweb: Remove characters entities entirely when shortening string
Jakub Narebski [Sun, 30 Jul 2006 20:36:04 +0000 (22:36 +0200)]
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>
18 years agogitweb: Headers refactoring - use git_header_div for header divs
Jakub Narebski [Sun, 30 Jul 2006 18:32:01 +0000 (20:32 +0200)]
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>
18 years agogitweb: Remove $project from git_get_paging_nav arguments
Jakub Narebski [Sun, 30 Jul 2006 18:31:00 +0000 (20:31 +0200)]
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>
18 years agogitweb: Pager refactoring - use git_get_paging_nav for pagination
Jakub Narebski [Sun, 30 Jul 2006 15:49:00 +0000 (17:49 +0200)]
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>
18 years agogitweb: Add "\n" after <br/> in git_page_nav
Jakub Narebski [Sun, 30 Jul 2006 14:14:43 +0000 (16:14 +0200)]
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>
18 years agogitweb: Show project descriptions with utf-8 characters in project list correctly
Jakub Narebski [Sun, 30 Jul 2006 15:47:22 +0000 (17:47 +0200)]
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>
18 years agogitweb: Replace form-feed character by ^L
Jakub Narebski [Sun, 30 Jul 2006 13:02:27 +0000 (15:02 +0200)]
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>
18 years agogitweb: Navbar refactoring - use git_page_nav to generate navigation bar
Jakub Narebski [Sun, 30 Jul 2006 13:01:07 +0000 (15:01 +0200)]
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>
18 years agogitweb: Add git_page_nav for later use
Jakub Narebski [Sun, 30 Jul 2006 12:59:57 +0000 (14:59 +0200)]
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>
18 years agogitweb: Cleanup - chomp @lines in consistent style
Jakub Narebski [Sun, 30 Jul 2006 12:58:11 +0000 (14:58 +0200)]
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>
18 years agogitweb: Cleanup - chomp $line in consistent style
Jakub Narebski [Sun, 30 Jul 2006 02:08:17 +0000 (04:08 +0200)]
gitweb: Cleanup - chomp $line in consistent style

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: More explicit error messages for open "-|"
Jakub Narebski [Sat, 29 Jul 2006 21:01:00 +0000 (23:01 +0200)]
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>
18 years agogitweb: simplify git_get_hash_by_path
Jakub Narebski [Sat, 29 Jul 2006 20:55:01 +0000 (22:55 +0200)]
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>
18 years agogitweb: Use list for of open for running git commands, thorougly.
Jakub Narebski [Mon, 31 Jul 2006 01:28:34 +0000 (18:28 -0700)]
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>
18 years agogitweb: whitespace cleanup
Jakub Narebski [Sat, 29 Jul 2006 20:43:40 +0000 (22:43 +0200)]
gitweb: whitespace cleanup

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agotar-tree: illustrate an obscure feature better
Johannes Schindelin [Mon, 31 Jul 2006 00:26:27 +0000 (02:26 +0200)]
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>
18 years agogit.c: allow alias expansion without a git directory
Matthias Lederhofer [Sun, 30 Jul 2006 01:30:29 +0000 (03:30 +0200)]
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>
18 years agosetup_git_directory_gently: do not barf when GIT_DIR is given.
Matthias Lederhofer [Sun, 30 Jul 2006 01:30:29 +0000 (03:30 +0200)]
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>
18 years agoBuild on Debian GNU/kFreeBSD
Gerrit Pape [Sat, 29 Jul 2006 16:26:18 +0000 (16:26 +0000)]
Build on Debian GNU/kFreeBSD

Patch from Petr Salinger to make the build process detect and support the
Debian GNU/kFreeBSD architecture, see
 http://bugs.debian.org/380209

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'lt/web'
Junio C Hamano [Sun, 30 Jul 2006 20:35:08 +0000 (13:35 -0700)]
Merge branch 'lt/web'

* lt/web:
  gitweb.cgi: git_blame2: slight optimization reading the blame lines
  gitweb.cgi: git_blame2: Revision blocks now have alternating colors
  gitweb.cgi: git_blame2: Allow back-trekking through commits
  gitweb.cgi: git_blame2: an alternative simple working git blame

18 years agoMerge branch '__/setup-n-mv'
Junio C Hamano [Sun, 30 Jul 2006 20:34:52 +0000 (13:34 -0700)]
Merge branch '__/setup-n-mv'

* __/setup-n-mv:
  Call setup_git_directory() much earlier
  Call setup_git_directory() early

18 years agoMerge branch 'js/mv'
Junio C Hamano [Sun, 30 Jul 2006 20:24:48 +0000 (13:24 -0700)]
Merge branch 'js/mv'

* js/mv:
  builtin git-mv: support moving directories
  Make git-mv a builtin
  Extract helper bits from c-merge-recursive work

18 years agoMerge branch 'jn/make'
Junio C Hamano [Sun, 30 Jul 2006 20:24:29 +0000 (13:24 -0700)]
Merge branch 'jn/make'

* jn/make:
  Set datarootdir in config.mak.in
  Quote all calls to GIT_CONF_APPEND_LINE
  Typofix in configure.ac comment.
  configure.ac vertical whitespace usage cleanup
  autoconf: Checks for some programs
  autoconf: Checks for libraries
  autoconf: Checks for some library functions.
  autoconf: Checks for typedefs, structures, and compiler characteristics.
  autoconf: Preparing the way for autodetection
  Copy description of build configuration variables to configure.ac
  Teach make clean about configure and autoconf
  autoconf: Use autoconf to write installation directories to config.mak.autogen

18 years agoMerge branch 'lt/setup' into __/setup-n-mv
Junio C Hamano [Sat, 29 Jul 2006 08:54:54 +0000 (01:54 -0700)]
Merge branch 'lt/setup' into __/setup-n-mv

This merges the new built-in calling convention code into Johannes's
builtin-mv topic in order to resolve their conflicts early on.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoCall setup_git_directory() much earlier
Linus Torvalds [Sat, 29 Jul 2006 05:44:25 +0000 (22:44 -0700)]
Call setup_git_directory() much earlier

This changes the calling convention of built-in commands and
passes the "prefix" (i.e. pathname of $PWD relative to the
project root level) down to them.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoCall setup_git_directory() early
Linus Torvalds [Sat, 29 Jul 2006 04:21:48 +0000 (21:21 -0700)]
Call setup_git_directory() early

Any git command that expects to work in a subdirectory of a project, and
that reads the git config files (which is just about all of them) needs to
make sure that it does the "setup_git_directory()" call before it tries to
read the config file.

This means, among other things, that we need to move the call out of
"init_revisions()", and into the caller.

This does the mostly trivial conversion to do that.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDisplay an error from update-ref if target ref name is invalid.
Shawn Pearce [Sat, 29 Jul 2006 03:44:51 +0000 (23:44 -0400)]
Display an error from update-ref if target ref name is invalid.

Alex Riesen (raa.lkml@gmail.com) recently observed that git branch
would fail with no error message due to unexpected situations with
regards to refs.  For example, if .git/refs/heads/gu is a file but
"git branch -b refs/heads/gu/fixa HEAD" was invoked by the user
it would fail silently due to refs/heads/gu being a file and not
a directory.

This change adds a test for trying to create a ref within a directory
that is actually currently a file, and adds error printing within
the ref locking routine should the resolve operation fail.

The error printing code probably belongs at this level of the library
as other failures within the ref locking, writing and logging code
are also currently at this level of the code.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix http-fetch
Johannes Schindelin [Sat, 29 Jul 2006 00:10:07 +0000 (02:10 +0200)]
Fix http-fetch

With the latest changes in fetch.c, http-fetch crashed accessing
write_ref[i], where write_ref was NULL.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'pb/multi-fetch'
Junio C Hamano [Fri, 28 Jul 2006 20:25:20 +0000 (13:25 -0700)]
Merge branch 'pb/multi-fetch'

* pb/multi-fetch:
  Teach git-http-fetch the --stdin switch
  Teach git-local-fetch the --stdin switch
  Make pull() support fetching multiple targets at once
  Make pull() take some implicit data as explicit arguments

18 years agoMerge branch 'lt/web'
Junio C Hamano [Fri, 28 Jul 2006 20:19:38 +0000 (13:19 -0700)]
Merge branch 'lt/web'

18 years agoMerge branch 'js/cvs'
Junio C Hamano [Fri, 28 Jul 2006 20:18:19 +0000 (13:18 -0700)]
Merge branch 'js/cvs'

* js/cvs:
  cvsserver: imitate git-update-ref when committing

18 years agoMerge branch 'js/alias-p'
Junio C Hamano [Fri, 28 Jul 2006 19:33:57 +0000 (12:33 -0700)]
Merge branch 'js/alias-p'

* js/alias-p:
  git wrapper: add --git-dir=<path> and --bare options
  Allow an alias to start with "-p"

18 years agoMerge branch 'jc/diff'
Junio C Hamano [Fri, 28 Jul 2006 19:23:52 +0000 (12:23 -0700)]
Merge branch 'jc/diff'

* jc/diff:
  git-diff A...B to (usually) mean "git-diff `git-merge-base A B` B"

18 years agot4103: fix binary patch application test.
Junio C Hamano [Fri, 28 Jul 2006 19:23:28 +0000 (12:23 -0700)]
t4103: fix binary patch application test.

The generated binary patch was _not_ binary -- earlier I made
the --full-index flag to imply binary patch generation to the diff
machinery, but later we made it independent from --binary (although
the latter implies the former).

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-apply -R: binary patches are irreversible for now.
Junio C Hamano [Fri, 28 Jul 2006 19:21:17 +0000 (12:21 -0700)]
git-apply -R: binary patches are irreversible for now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoTeach git-apply about '-R'
Johannes Schindelin [Fri, 28 Jul 2006 15:46:11 +0000 (17:46 +0200)]
Teach git-apply about '-R'

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMakefile: ssh-pull.o depends on ssh-fetch.c
Johannes Schindelin [Fri, 28 Jul 2006 09:17:46 +0000 (11:17 +0200)]
Makefile: ssh-pull.o depends on ssh-fetch.c

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agolog and diff family: honor config even from subdirectories
Junio C Hamano [Fri, 28 Jul 2006 05:55:44 +0000 (22:55 -0700)]
log and diff family: honor config even from subdirectories

There currently is an unfortunate circular dependency between
what init_revisions (the command line revision specification
parser) does and setting up the log and diff options.  The
function uses setup_git_directory() to find the root of the
project relative to the current directory and calls diff_setup()
to prepare diff generation.  However, some of the things that
diff_setup() does needs to depend on the configuration variable,
which needs to be read after setup_git_directory() is called.

This patch is a low impact workaround.  It first lets
init_revisions() to run and do its thing, then uses git_config()
and diff_setup() after it returns, so that configuration
variables that affects the diff operation can be used from
subdirectories.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-reset: detect update-ref error and report it.
Junio C Hamano [Fri, 28 Jul 2006 05:27:44 +0000 (22:27 -0700)]
git-reset: detect update-ref error and report it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agolost-found: use fsck-objects --full
Junio C Hamano [Fri, 28 Jul 2006 05:15:01 +0000 (22:15 -0700)]
lost-found: use fsck-objects --full

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoTeach git-http-fetch the --stdin switch
Petr Baudis [Thu, 27 Jul 2006 21:56:22 +0000 (23:56 +0200)]
Teach git-http-fetch the --stdin switch

Speeds up things quite a lot when fetching tags with Cogito.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoTeach git-local-fetch the --stdin switch
Petr Baudis [Thu, 27 Jul 2006 21:56:19 +0000 (23:56 +0200)]
Teach git-local-fetch the --stdin switch

This makes it possible to fetch many commits (refs) at once, greatly
speeding up cg-clone.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake pull() support fetching multiple targets at once
Petr Baudis [Thu, 27 Jul 2006 21:56:17 +0000 (23:56 +0200)]
Make pull() support fetching multiple targets at once

pull() now takes an array of arguments instead of just one of each kind.
Currently, no users use the new capability, but that'll change.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake pull() take some implicit data as explicit arguments
Petr Baudis [Thu, 27 Jul 2006 21:56:14 +0000 (23:56 +0200)]
Make pull() take some implicit data as explicit arguments

Currently it's a bit weird that pull() takes a single argument
describing the commit but takes the write_ref from a global variable.
This makes it take that as a parameter as well, which might be nicer
for the libification in the future, but especially it will make for
nicer code when we implement pull()ing multiple commits at once.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agomailinfo: accept >From in message header
Michael S. Tsirkin [Thu, 27 Jul 2006 14:03:43 +0000 (17:03 +0300)]
mailinfo: accept >From in message header

Mail I get sometimes has multiple From lines, like this:

    From Majordomo@vger.kernel.org  Thu Jul 27 16:39:36 2006
    >From mtsirkin  Thu Jul 27 16:39:36 2006
    Received: from yok.mtl.com [10.0.8.11]
    ...

which confuses git-mailinfo since that does not recognize >From
as a valid header line.

This patch makes it recognize >From XXX as a valid header line.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove -d from *-fetch usage strings
Petr Baudis [Thu, 27 Jul 2006 18:58:53 +0000 (20:58 +0200)]
Remove -d from *-fetch usage strings

This is a really ancient remnant of the short era of delta objects stored
directly in the object database.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agodaemon: documentation for --reuseaddr, --detach and --pid-file
Matthias Lederhofer [Fri, 14 Jul 2006 15:53:29 +0000 (17:53 +0200)]
daemon: documentation for --reuseaddr, --detach and --pid-file

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agocvsserver: imitate git-update-ref when committing
Johannes Schindelin [Wed, 26 Jul 2006 20:51:52 +0000 (22:51 +0200)]
cvsserver: imitate git-update-ref when committing

git-update-ref writes into the lockfile, and renames it afterwards. Like
commit v1.3.0-rc3~22, it is not only cleaner, but also helps with shared
setups: every developer can have a different primary group; what matters
is that $GIT_DIR/refs/heads has to be writable by a group you are in.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoinstaweb: Be more clear if httpd or the browser fail
Johannes Schindelin [Wed, 26 Jul 2006 21:11:46 +0000 (23:11 +0200)]
instaweb: Be more clear if httpd or the browser fail

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agobuiltin git-mv: support moving directories
Johannes Schindelin [Wed, 26 Jul 2006 17:47:54 +0000 (19:47 +0200)]
builtin git-mv: support moving directories

This fixes the builtin mv for the test which Josef provided, and also
fixes moving directories into existing directories, as noted by Jon Smirl.
In case the destination exists, fail early (this cannot be overridden
by -f).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake git-mv a builtin
Johannes Schindelin [Wed, 26 Jul 2006 01:52:35 +0000 (03:52 +0200)]
Make git-mv a builtin

This also moves add_file_to_index() to read-cache.c. Oh, and while
touching builtin-add.c, it also removes a duplicate git_config() call.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoExtract helper bits from c-merge-recursive work
Johannes Schindelin [Wed, 26 Jul 2006 04:32:18 +0000 (21:32 -0700)]
Extract helper bits from c-merge-recursive work

This backports the pieces that are not uncooked from the merge-recursive
WIP we have seen earlier, to be used in git-mv rewritten in C.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'pb/configure'
Junio C Hamano [Wed, 26 Jul 2006 20:35:35 +0000 (13:35 -0700)]
Merge branch 'pb/configure'

* pb/configure:
  Rename man1 and man7 variables to man1dir and man7dir
  Allow INSTALL, bindir, mandir to be set in main Makefile

18 years agogit-cvsserver: support multiline commit messages
Johannes Schindelin [Wed, 26 Jul 2006 19:59:08 +0000 (21:59 +0200)]
git-cvsserver: support multiline commit messages

Earlier, cvsserver barfed when you tried to check in files with a
multiline commit message.

That is what Argumentx is for... Argument: lines can be followed by
several Argumentx: lines, which means they should be appended.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agot7001: add test for git-mv dir1 dir2/
Johannes Schindelin [Wed, 26 Jul 2006 17:41:05 +0000 (19:41 +0200)]
t7001: add test for git-mv dir1 dir2/

If dir2 already exists, git-mv should move dir1 _into_dir2/.
Noticed by Jon Smirl.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: fix two warnings
Johannes Schindelin [Wed, 26 Jul 2006 14:58:35 +0000 (16:58 +0200)]
gitweb: fix two warnings

These warnings cluttered up my log.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-instaweb: respect bindir from Makefile
Johannes Schindelin [Wed, 26 Jul 2006 14:32:51 +0000 (16:32 +0200)]
git-instaweb: respect bindir from Makefile

Not everybody installs git to /usr/bin/git.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-instaweb: some Apache have mod_cgi builtin
Johannes Schindelin [Wed, 26 Jul 2006 14:33:18 +0000 (16:33 +0200)]
git-instaweb: some Apache have mod_cgi builtin

So test for it, and do not always try to load mod_cgi.o.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agot4112: simplify the test and remove unneeded working tree file.
Junio C Hamano [Wed, 26 Jul 2006 18:01:07 +0000 (11:01 -0700)]
t4112: simplify the test and remove unneeded working tree file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoExtend testing git-mv for renaming of subdirectories
Josef Weidendorfer [Wed, 26 Jul 2006 13:44:08 +0000 (15:44 +0200)]
Extend testing git-mv for renaming of subdirectories

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit wrapper: add --git-dir=<path> and --bare options
Johannes Schindelin [Tue, 25 Jul 2006 18:24:22 +0000 (20:24 +0200)]
git wrapper: add --git-dir=<path> and --bare options

With this, you can say

git --bare repack -a -d

inside a bare repository, and it will actually work. While at it,
also move the --version, --help and --exec-path options to the
handle_options() function.

While at documenting the new options, also document the --paginate
option.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAllow an alias to start with "-p"
Johannes Schindelin [Mon, 24 Jul 2006 12:10:45 +0000 (14:10 +0200)]
Allow an alias to start with "-p"

Now, something like

[alias]
pd = -p diff

works as expected.

[jc: a follow-up fix from Jeff King folded in.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agocvsserver: avoid warning about active db handles v1.4.2-rc2
Johannes Schindelin [Tue, 25 Jul 2006 11:57:57 +0000 (13:57 +0200)]
cvsserver: avoid warning about active db handles

Turns out that DBD::SQLite does not favour preparing statements which are
never executed. So, turn all 4 statements, which were prepared _always_,
into methods, like the other 12 prepared statements.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>