Skip to contentSkip to conversation

gitweb: fix commitdiff for root commits

PATCH New Jakub Narebski 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitweb: fix commitdiff for root commits

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).

---
Patch based on 'next' branch (234416bff6c426a9abaaacef80ba3679c0ce8f39)

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index d0672cd..bbea21a 100755
@@ -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");
Signature · 1 line
1.4.1.1