mirror of
https://github.com/git/git.git
synced 2026-03-14 02:43:25 +01:00
Merge branch 'jc/web' into next
* jc/web: gitweb: make leftmost column of blame less cluttered. gitweb: document webserver configuration for common gitweb/repo URLs. gitweb: Escape ESCAPE (\e) character escape tilde in Documentation/git-rev-parse.txt Error in test description of t1200-tutorial lock_ref_sha1_basic does not remove empty directories on BSD
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
caret=^
|
||||
startsb=[
|
||||
endsb=]
|
||||
tilde=~
|
||||
|
||||
ifdef::backend-docbook[]
|
||||
[gitlink-inlinemacro]
|
||||
|
||||
@@ -138,7 +138,7 @@ syntax.
|
||||
'rev{caret}0' means the commit itself and is used when 'rev' is the
|
||||
object name of a tag object that refers to a commit object.
|
||||
|
||||
* A suffix '~<n>' to a revision parameter means the commit
|
||||
* A suffix '{tilde}<n>' to a revision parameter means the commit
|
||||
object that is the <n>th generation grand-parent of the named
|
||||
commit object, following only the first parent. I.e. rev~3 is
|
||||
equivalent to rev{caret}{caret}{caret} which is equivalent to\
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
GIT web Interface
|
||||
=================
|
||||
|
||||
The one working on:
|
||||
http://www.kernel.org/git/
|
||||
@@ -6,7 +7,8 @@ The one working on:
|
||||
From the git version 1.4.0 gitweb is bundled with git.
|
||||
|
||||
|
||||
How to configure gitweb for your local system:
|
||||
How to configure gitweb for your local system
|
||||
---------------------------------------------
|
||||
|
||||
You can specify the following configuration variables when building GIT:
|
||||
* GITWEB_SITENAME
|
||||
@@ -29,6 +31,28 @@ You can specify the following configuration variables when building GIT:
|
||||
environment variable will be loaded instead of the file
|
||||
specified when gitweb.cgi was created.
|
||||
|
||||
|
||||
Webserver configuration
|
||||
-----------------------
|
||||
|
||||
If you want to have one URL for both gitweb and your http://
|
||||
repositories, you can configure apache like this:
|
||||
|
||||
<VirtualHost www:80>
|
||||
ServerName git.domain.org
|
||||
DocumentRoot /pub/git
|
||||
RewriteEngine on
|
||||
RewriteRule ^/(.*\.git/(?!/?(info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT]
|
||||
</VirtualHost>
|
||||
|
||||
The above configuration expects your public repositories to live under
|
||||
/pub/git and will serve them as http://git.domain.org/dir-under-pub-git,
|
||||
both as cloneable GIT URL and as browseable gitweb interface.
|
||||
If you then start your git-daemon with --base-path=/pub/git --export-all
|
||||
then you can even use the git:// URL with exactly the same path.
|
||||
|
||||
|
||||
|
||||
Originally written by:
|
||||
Kay Sievers <kay.sievers@vrfy.org>
|
||||
|
||||
|
||||
100
gitweb/gitweb.perl
Executable file → Normal file
100
gitweb/gitweb.perl
Executable file → Normal file
@@ -485,6 +485,7 @@ sub esc_html {
|
||||
$str = decode("utf8", $str, Encode::FB_DEFAULT);
|
||||
$str = escapeHTML($str);
|
||||
$str =~ s/\014/^L/g; # escape FORM FEED (FF) character (e.g. in COPYING file)
|
||||
$str =~ s/\033/^[/g; # "escape" ESCAPE (\e) character (e.g. commit 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1)
|
||||
return $str;
|
||||
}
|
||||
|
||||
@@ -2449,9 +2450,64 @@ sub git_tag {
|
||||
git_footer_html();
|
||||
}
|
||||
|
||||
sub git_blame_flush_chunk {
|
||||
my ($name, $revdata, $color, $rev, @line) = @_;
|
||||
my $label = substr($rev, 0, 8);
|
||||
my $line = scalar(@line);
|
||||
my $cnt = 0;
|
||||
my $pop = '';
|
||||
|
||||
if ($revdata->{$rev} ne '') {
|
||||
$pop = ' title="' . esc_html($revdata->{$rev}) . '"';
|
||||
}
|
||||
|
||||
for (@line) {
|
||||
my ($lineno, $data) = @$_;
|
||||
$cnt++;
|
||||
print "<tr class=\"$color\">\n";
|
||||
if ($cnt == 1) {
|
||||
print "<td class=\"sha1\"$pop";
|
||||
if ($line > 1) {
|
||||
print " rowspan=\"$line\"";
|
||||
}
|
||||
print ">";
|
||||
print $cgi->a({-href => href(action=>"commit",
|
||||
hash=>$rev,
|
||||
file_name=>$name)},
|
||||
$label);
|
||||
print "</td>\n";
|
||||
}
|
||||
print "<td class=\"linenr\">".
|
||||
"<a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
|
||||
esc_html($lineno) . "</a></td>\n";
|
||||
print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
# We can have up to N*2 lines. If it is more than N lines, split it
|
||||
# into two to avoid orphans.
|
||||
sub git_blame_flush_chunk_1 {
|
||||
my ($chunk_cap, $name, $revdata, $color, $rev, @chunk) = @_;
|
||||
if ($chunk_cap < @chunk) {
|
||||
my @first = splice(@chunk, 0, @chunk/2);
|
||||
git_blame_flush_chunk($name,
|
||||
$revdata,
|
||||
$color,
|
||||
$rev,
|
||||
@first);
|
||||
}
|
||||
git_blame_flush_chunk($name,
|
||||
$revdata,
|
||||
$color,
|
||||
$rev,
|
||||
@chunk);
|
||||
}
|
||||
|
||||
sub git_blame2 {
|
||||
my $fd;
|
||||
my $ftype;
|
||||
my $chunk_cap = 20;
|
||||
|
||||
my ($have_blame) = gitweb_check_feature('blame');
|
||||
if (!$have_blame) {
|
||||
@@ -2494,27 +2550,45 @@ sub git_blame2 {
|
||||
<table class="blame">
|
||||
<tr><th>Commit</th><th>Line</th><th>Data</th></tr>
|
||||
HTML
|
||||
my @chunk = ();
|
||||
my %revdata = ();
|
||||
while (<$fd>) {
|
||||
/^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
|
||||
my $full_rev = $1;
|
||||
my $rev = substr($full_rev, 0, 8);
|
||||
my $lineno = $2;
|
||||
my $data = $3;
|
||||
|
||||
my ($full_rev, $author, $date, $lineno, $data) =
|
||||
/^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/;
|
||||
if (!exists $revdata{$full_rev}) {
|
||||
$revdata{$full_rev} = "$author, $date";
|
||||
}
|
||||
if (!defined $last_rev) {
|
||||
$last_rev = $full_rev;
|
||||
} elsif ($last_rev ne $full_rev) {
|
||||
git_blame_flush_chunk_1($chunk_cap,
|
||||
$file_name,
|
||||
\%revdata,
|
||||
$rev_color[$current_color],
|
||||
$last_rev, @chunk);
|
||||
@chunk = ();
|
||||
$last_rev = $full_rev;
|
||||
$current_color = ++$current_color % $num_colors;
|
||||
}
|
||||
print "<tr class=\"$rev_color[$current_color]\">\n";
|
||||
print "<td class=\"sha1\">" .
|
||||
$cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)},
|
||||
esc_html($rev)) . "</td>\n";
|
||||
print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
|
||||
esc_html($lineno) . "</a></td>\n";
|
||||
print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
|
||||
print "</tr>\n";
|
||||
elsif ($chunk_cap * 2 < @chunk) {
|
||||
# We have more than N*2 lines from the same
|
||||
# revision. Flush N lines and leave N lines
|
||||
# in @chunk to avoid orphaned lines.
|
||||
my @first = splice(@chunk, 0, $chunk_cap);
|
||||
git_blame_flush_chunk($file_name,
|
||||
\%revdata,
|
||||
$rev_color[$current_color],
|
||||
$last_rev, @first);
|
||||
}
|
||||
push @chunk, [$lineno, $data];
|
||||
}
|
||||
if (@chunk) {
|
||||
git_blame_flush_chunk_1($chunk_cap,
|
||||
$file_name,
|
||||
\%revdata,
|
||||
$rev_color[$current_color],
|
||||
$last_rev, @chunk);
|
||||
}
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Johannes Schindelin
|
||||
#
|
||||
|
||||
test_description='Test git-rev-parse with different parent options'
|
||||
test_description='A simple turial in the form of a test case'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user