]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: add patches view
authorGiuseppe Bilotta <redacted>
Thu, 18 Dec 2008 07:13:18 +0000 (08:13 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:38 +0000 (00:50 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index f23a46672ff513dcbd3d6180872ce3a13d04aa134d3dde6ec79c3e9104fed86a..3d3c03050315e353dc55a933ee40e5433a1eae9d5d86fb4b650efcea3ac70fe7 100755 (executable)
@@ -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');
 }
 
This page took 0.1112 seconds and 4 git commands to generate.