Skip to content

Commit a3823e5

Browse files
jnarebgitster
authored andcommitted
gitweb: Use href(-replay=>1, action=>...) to generate alternate views
Use href(action=>..., -replay=>1) to generate links to alternate views of current page in the $formats_nav (bottom) part of page_nav navigation bar. This form is used only when all parameters are repeated, and when the replay form is shorter. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7afd77b commit a3823e5

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

gitweb/gitweb.perl

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,11 +3911,11 @@ sub git_blame2 {
39113911
or die_error(undef, "Open git-blame failed");
39123912
git_header_html();
39133913
my $formats_nav =
3914-
$cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
3914+
$cgi->a({-href => href(action=>"blob", -replay=>1)},
39153915
"blob") .
39163916
" | " .
3917-
$cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
3918-
"history") .
3917+
$cgi->a({-href => href(action=>"history", -replay=>1)},
3918+
"history") .
39193919
" | " .
39203920
$cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
39213921
"HEAD");
@@ -4191,26 +4191,24 @@ sub git_blob {
41914191
if (defined $file_name) {
41924192
if ($have_blame) {
41934193
$formats_nav .=
4194-
$cgi->a({-href => href(action=>"blame", hash_base=>$hash_base,
4195-
hash=>$hash, file_name=>$file_name)},
4194+
$cgi->a({-href => href(action=>"blame", -replay=>1)},
41964195
"blame") .
41974196
" | ";
41984197
}
41994198
$formats_nav .=
4200-
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
4201-
hash=>$hash, file_name=>$file_name)},
4199+
$cgi->a({-href => href(action=>"history", -replay=>1)},
42024200
"history") .
42034201
" | " .
4204-
$cgi->a({-href => href(action=>"blob_plain",
4205-
hash=>$hash, file_name=>$file_name)},
4202+
$cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
42064203
"raw") .
42074204
" | " .
42084205
$cgi->a({-href => href(action=>"blob",
42094206
hash_base=>"HEAD", file_name=>$file_name)},
42104207
"HEAD");
42114208
} else {
42124209
$formats_nav .=
4213-
$cgi->a({-href => href(action=>"blob_plain", hash=>$hash)}, "raw");
4210+
$cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
4211+
"raw");
42144212
}
42154213
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
42164214
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
@@ -4273,8 +4271,7 @@ sub git_tree {
42734271
my @views_nav = ();
42744272
if (defined $file_name) {
42754273
push @views_nav,
4276-
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
4277-
hash=>$hash, file_name=>$file_name)},
4274+
$cgi->a({-href => href(action=>"history", -replay=>1)},
42784275
"history"),
42794276
$cgi->a({-href => href(action=>"tree",
42804277
hash_base=>"HEAD", file_name=>$file_name)},
@@ -4742,10 +4739,7 @@ sub git_blobdiff {
47424739
# header
47434740
if ($format eq 'html') {
47444741
my $formats_nav =
4745-
$cgi->a({-href => href(action=>"blobdiff_plain",
4746-
hash=>$hash, hash_parent=>$hash_parent,
4747-
hash_base=>$hash_base, hash_parent_base=>$hash_parent_base,
4748-
file_name=>$file_name, file_parent=>$file_parent)},
4742+
$cgi->a({-href => href(action=>"blobdiff_plain", -replay=>1)},
47494743
"raw");
47504744
git_header_html(undef, $expires);
47514745
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
@@ -4819,8 +4813,7 @@ sub git_commitdiff {
48194813
my $formats_nav;
48204814
if ($format eq 'html') {
48214815
$formats_nav =
4822-
$cgi->a({-href => href(action=>"commitdiff_plain",
4823-
hash=>$hash, hash_parent=>$hash_parent)},
4816+
$cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
48244817
"raw");
48254818

48264819
if (defined $hash_parent &&

0 commit comments

Comments
 (0)