From: Giuseppe Bilotta Date: Thu, 18 Dec 2008 07:13:18 +0000 (+0100) Subject: gitweb: add patches view X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/2ba09530f78bbe63252dcce5419010176a680f1da0d56d35aab57ed7fd611678 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index f23a466..3d3c030 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -508,6 +508,7 @@ our %actions = ( "history" => \&git_history, "log" => \&git_log, "patch" => \&git_patch, + "patches" => \&git_patches, "rss" => \&git_rss, "atom" => \&git_atom, "search" => \&git_search, @@ -5490,7 +5491,15 @@ sub git_commitdiff { } push @commit_spec, '-n', "$hash_parent..$hash"; } else { - push @commit_spec, '-1', '--root', $hash; + if ($params{-single}) { + push @commit_spec, '-1'; + } else { + if ($patch_max > 0) { + push @commit_spec, "-$patch_max"; + } + push @commit_spec, "-n"; + } + push @commit_spec, '--root', $hash; } open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8', '--stdout', @commit_spec @@ -5586,6 +5595,10 @@ sub git_commitdiff_plain { # format-patch-style patches sub git_patch { + git_commitdiff(-format => 'patch', -single=> 1); +} + +sub git_patches { git_commitdiff(-format => 'patch'); }