mirror of
https://github.com/git/git.git
synced 2026-03-14 18:59:04 +01:00
Merge branch 'master' into next
* master: 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
This commit is contained in:
@@ -1683,17 +1683,16 @@ sub git_print_page_path {
|
||||
my $type = shift;
|
||||
my $hb = shift;
|
||||
|
||||
if (!defined $name) {
|
||||
print "<div class=\"page_path\">/</div>\n";
|
||||
} else {
|
||||
|
||||
print "<div class=\"page_path\">";
|
||||
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
|
||||
-title => 'tree root'}, "[$project]");
|
||||
print " / ";
|
||||
if (defined $name) {
|
||||
my @dirname = split '/', $name;
|
||||
my $basename = pop @dirname;
|
||||
my $fullname = '';
|
||||
|
||||
print "<div class=\"page_path\">";
|
||||
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
|
||||
-title => 'tree root'}, "[$project]");
|
||||
print " / ";
|
||||
foreach my $dir (@dirname) {
|
||||
$fullname .= ($fullname ? '/' : '') . $dir;
|
||||
print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
|
||||
@@ -1709,11 +1708,12 @@ sub git_print_page_path {
|
||||
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
|
||||
hash_base=>$hb),
|
||||
-title => $name}, esc_html($basename));
|
||||
print " / ";
|
||||
} else {
|
||||
print esc_html($basename);
|
||||
}
|
||||
print "<br/></div>\n";
|
||||
}
|
||||
print "<br/></div>\n";
|
||||
}
|
||||
|
||||
# sub git_print_log (\@;%) {
|
||||
@@ -1790,13 +1790,13 @@ sub git_print_tree_entry {
|
||||
if ($t->{'type'} eq "blob") {
|
||||
print "<td class=\"list\">" .
|
||||
$cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
|
||||
file_name=>"$basedir$t->{'name'}", %base_key),
|
||||
-class => "list"}, esc_html($t->{'name'})) . "</td>\n";
|
||||
file_name=>"$basedir$t->{'name'}", %base_key),
|
||||
-class => "list"}, esc_html($t->{'name'})) . "</td>\n";
|
||||
print "<td class=\"link\">";
|
||||
if ($have_blame) {
|
||||
print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
|
||||
file_name=>"$basedir$t->{'name'}", %base_key)},
|
||||
"blame");
|
||||
file_name=>"$basedir$t->{'name'}", %base_key)},
|
||||
"blame");
|
||||
}
|
||||
if (defined $hash_base) {
|
||||
if ($have_blame) {
|
||||
@@ -1808,8 +1808,8 @@ sub git_print_tree_entry {
|
||||
}
|
||||
print " | " .
|
||||
$cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
|
||||
file_name=>"$basedir$t->{'name'}")},
|
||||
"raw");
|
||||
file_name=>"$basedir$t->{'name'}")},
|
||||
"raw");
|
||||
print "</td>\n";
|
||||
|
||||
} elsif ($t->{'type'} eq "tree") {
|
||||
@@ -1877,7 +1877,7 @@ sub git_difftree_body {
|
||||
print "<td>";
|
||||
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
|
||||
hash_base=>$hash, file_name=>$diff{'file'}),
|
||||
-class => "list"}, esc_html($diff{'file'}));
|
||||
-class => "list"}, esc_html($diff{'file'}));
|
||||
print "</td>\n";
|
||||
print "<td>$mode_chng</td>\n";
|
||||
print "<td class=\"link\">";
|
||||
@@ -1904,11 +1904,11 @@ sub git_difftree_body {
|
||||
print " | ";
|
||||
}
|
||||
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
|
||||
file_name=>$diff{'file'})},
|
||||
"blame") . " | ";
|
||||
file_name=>$diff{'file'})},
|
||||
"blame") . " | ";
|
||||
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
|
||||
file_name=>$diff{'file'})},
|
||||
"history");
|
||||
file_name=>$diff{'file'})},
|
||||
"history");
|
||||
print "</td>\n";
|
||||
|
||||
} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
|
||||
@@ -1929,8 +1929,8 @@ sub git_difftree_body {
|
||||
}
|
||||
print "<td>";
|
||||
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
|
||||
hash_base=>$hash, file_name=>$diff{'file'}),
|
||||
-class => "list"}, esc_html($diff{'file'}));
|
||||
hash_base=>$hash, file_name=>$diff{'file'}),
|
||||
-class => "list"}, esc_html($diff{'file'}));
|
||||
print "</td>\n";
|
||||
print "<td>$mode_chnge</td>\n";
|
||||
print "<td class=\"link\">";
|
||||
@@ -1941,19 +1941,19 @@ sub git_difftree_body {
|
||||
print $cgi->a({-href => "#patch$patchno"}, "patch");
|
||||
} else {
|
||||
print $cgi->a({-href => href(action=>"blobdiff",
|
||||
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
|
||||
hash_base=>$hash, hash_parent_base=>$parent,
|
||||
file_name=>$diff{'file'})},
|
||||
"diff");
|
||||
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
|
||||
hash_base=>$hash, hash_parent_base=>$parent,
|
||||
file_name=>$diff{'file'})},
|
||||
"diff");
|
||||
}
|
||||
print " | ";
|
||||
}
|
||||
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
|
||||
file_name=>$diff{'file'})},
|
||||
"blame") . " | ";
|
||||
file_name=>$diff{'file'})},
|
||||
"blame") . " | ";
|
||||
print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
|
||||
file_name=>$diff{'file'})},
|
||||
"history");
|
||||
file_name=>$diff{'file'})},
|
||||
"history");
|
||||
print "</td>\n";
|
||||
|
||||
} elsif ($diff{'status'} eq "R" || $diff{'status'} eq "C") { # renamed or copied
|
||||
@@ -1981,19 +1981,19 @@ sub git_difftree_body {
|
||||
print $cgi->a({-href => "#patch$patchno"}, "patch");
|
||||
} else {
|
||||
print $cgi->a({-href => href(action=>"blobdiff",
|
||||
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
|
||||
hash_base=>$hash, hash_parent_base=>$parent,
|
||||
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
|
||||
"diff");
|
||||
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
|
||||
hash_base=>$hash, hash_parent_base=>$parent,
|
||||
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
|
||||
"diff");
|
||||
}
|
||||
print " | ";
|
||||
}
|
||||
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
|
||||
file_name=>$diff{'from_file'})},
|
||||
"blame") . " | ";
|
||||
file_name=>$diff{'from_file'})},
|
||||
"blame") . " | ";
|
||||
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
|
||||
file_name=>$diff{'from_file'})},
|
||||
"history");
|
||||
file_name=>$diff{'from_file'})},
|
||||
"history");
|
||||
print "</td>\n";
|
||||
|
||||
} # we should not encounter Unmerged (U) or Unknown (X) status
|
||||
@@ -2925,7 +2925,7 @@ sub git_tree {
|
||||
my $refs = git_get_references();
|
||||
my $ref = format_ref_marker($refs, $hash_base);
|
||||
git_header_html();
|
||||
my $base = "";
|
||||
my $basedir = '';
|
||||
my ($have_blame) = gitweb_check_feature('blame');
|
||||
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
|
||||
my @views_nav = ();
|
||||
@@ -2942,7 +2942,7 @@ sub git_tree {
|
||||
# FIXME: Should be available when we have no hash base as well.
|
||||
push @views_nav,
|
||||
$cgi->a({-href => href(action=>"snapshot", hash=>$hash)},
|
||||
"snapshot");
|
||||
"snapshot");
|
||||
}
|
||||
git_print_page_nav('tree','', $hash_base, undef, undef, join(' | ', @views_nav));
|
||||
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
|
||||
@@ -2953,12 +2953,39 @@ sub git_tree {
|
||||
print "<div class=\"title\">$hash</div>\n";
|
||||
}
|
||||
if (defined $file_name) {
|
||||
$base = esc_html("$file_name/");
|
||||
$basedir = $file_name;
|
||||
if ($basedir ne '' && substr($basedir, -1) ne '/') {
|
||||
$basedir .= '/';
|
||||
}
|
||||
}
|
||||
git_print_page_path($file_name, 'tree', $hash_base);
|
||||
print "<div class=\"page_body\">\n";
|
||||
print "<table cellspacing=\"0\">\n";
|
||||
my $alternate = 1;
|
||||
# '..' (top directory) link if possible
|
||||
if (defined $hash_base &&
|
||||
defined $file_name && $file_name =~ m![^/]+$!) {
|
||||
if ($alternate) {
|
||||
print "<tr class=\"dark\">\n";
|
||||
} else {
|
||||
print "<tr class=\"light\">\n";
|
||||
}
|
||||
$alternate ^= 1;
|
||||
|
||||
my $up = $file_name;
|
||||
$up =~ s!/?[^/]+$!!;
|
||||
undef $up unless $up;
|
||||
# based on git_print_tree_entry
|
||||
print '<td class="mode">' . mode_str('040000') . "</td>\n";
|
||||
print '<td class="list">';
|
||||
print $cgi->a({-href => href(action=>"tree", hash_base=>$hash_base,
|
||||
file_name=>$up)},
|
||||
"..");
|
||||
print "</td>\n";
|
||||
print "<td class=\"link\"></td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
foreach my $line (@entries) {
|
||||
my %t = parse_ls_tree_line($line, -z => 1);
|
||||
|
||||
@@ -2969,7 +2996,7 @@ sub git_tree {
|
||||
}
|
||||
$alternate ^= 1;
|
||||
|
||||
git_print_tree_entry(\%t, $base, $hash_base, $have_blame);
|
||||
git_print_tree_entry(\%t, $basedir, $hash_base, $have_blame);
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user