git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv6 2/4] gitweb: change call pattern for git_commitdiff

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Dec 18, 2008, 07:13 UTC
Message-ID
<1229584399-23879-3-git-send-email-giuseppe.bilotta@gmail.com>
In-Reply-To
<1229584399-23879-2-git-send-email-giuseppe.bilotta@gmail.com>
Since we are going to introduce an additional parameter for
git_commitdiff to tune patch view, we switch to named/hash-based
parameter passing for clarity and robustness.
---
 gitweb/gitweb.perl |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1006dfe..18d43e7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5412,7 +5412,8 @@ sub git_blobdiff_plain {
 }
 
 sub git_commitdiff {
-	my $format = shift || 'html';
+	my %params = @_;
+	my $format = $params{-format} || 'html';
 
 	my $patch_max;
 	if ($format eq 'patch') {
@@ -5620,12 +5621,12 @@ sub git_commitdiff {
 }
 
 sub git_commitdiff_plain {
-	git_commitdiff('plain');
+	git_commitdiff(-format => 'plain');
 }
 
 # format-patch-style patches
 sub git_patch {
-	git_commitdiff('patch');
+	git_commitdiff(-format => 'patch');
 }
 
 sub git_history {
-- 
1.5.6.5
Previous: Giuseppe BilottaNext: Giuseppe Bilotta
Message 3 of 5 in “[PATCHv6 0/4] gitweb: patch view”
  1. Giuseppe BilottaDec 18, 2008
  2. 1/4 gitweb: add patch viewGiuseppe Bilotta, Dec 18, 2008
  3. 2/4 gitweb: change call pattern for git_commitdiffGiuseppe Bilotta, Dec 18, 2008
  4. 3/4 gitweb: add patches viewGiuseppe Bilotta, Dec 18, 2008
  5. 4/4 gitweb: link to patch(es) view in commit(diff) and (short)log viewGiuseppe Bilotta, Dec 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.