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

[PATCH] gitweb: fix commitdiff for root commits

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 6, 2006, 14:14 UTC
Message-ID
<200608061614.25763.jnareb@gmail.com>

After changing all "-|" open invocations to list form, commitdiff for initial commit (without parent) got broken; it returned incorrectly empty patch earlier. Use '--root' option to git-diff-tree for initial (root) commit.

No checking for empty $hash_parent in git_commitdiff_plain -- we rely on gitweb to give correct parameters for commitdiff_plain action.

Noticed by Matthias Lederhofer (matled).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Patch based on 'next' branch (234416bff6c426a9abaaacef80ba3679c0ce8f39)
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d0672cd..bbea21a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2109,7 +2109,7 @@ sub git_commitdiff {
 		die_error(undef, "Unknown commit object");
 	}
 	if (!defined $hash_parent) {
-		$hash_parent = $co{'parent'};
+		$hash_parent = $co{'parent'} || '--root';
 	}
 	open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
 		or die_error(undef, "Open git-diff-tree failed");
-- 
1.4.1.1
Message 1 of 1 in “gitweb: fix commitdiff for root commits”
  1. gitweb: fix commitdiff for root commitsJakub Narebski, Aug 6, 2006

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.