gitweb: add patches view
The only difference between patch and patches view is in the treatement of single commits: the former only displays a single patch, whereas the latter displays a patchset leading to the specified commit. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Giuseppe Bilotta committed
Dec 18, 2008 at 08:13 UTC
a3411f8a2d3acc311991cf2221efa9de81cd03f7
1 file changed
+14
-1
gitweb/gitweb.perl
+14
-1
@@ -529,6 +529,7 @@ our %actions = (
529
"history" => \&git_history,
530
"log" => \&git_log,
531
"patch" => \&git_patch,
532
+ "patches" => \&git_patches,
533
"rss" => \&git_rss,
534
"atom" => \&git_atom,
535
"search" => \&git_search,
@@ -5529,7 +5530,15 @@ sub git_commitdiff {
5530
}
5531
push @commit_spec, '-n', "$hash_parent..$hash";
5532
} else {
5532
- push @commit_spec, '-1', '--root', $hash;
5533
+ if ($params{-single}) {
5534
+ push @commit_spec, '-1';
5535
+ } else {
5536
+ if ($patch_max > 0) {
5537
+ push @commit_spec, "-$patch_max";
5538
+ }
5539
+ push @commit_spec, "-n";
5540
+ }
5541
+ push @commit_spec, '--root', $hash;
5542
}
5543
open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
5544
'--stdout', @commit_spec
@@ -5625,6 +5634,10 @@ sub git_commitdiff_plain {
5634
5635
# format-patch-style patches
5636
sub git_patch {
5637
+ git_commitdiff(-format => 'patch', -single=> 1);
5638
+}
5639
+
5640
+sub git_patches {
5641
git_commitdiff(-format => 'patch');
5642
}
5643