@matheusbsbs / matheus-bagliano / commits / b5ff2cf9a6
Fork 0

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). Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Aug 6, 2006 at 16:14 UTC b5ff2cf9a6a4246a5443e904acf3165e89654b1e
1 file changed +1 -1
gitweb/gitweb.perl
+1 -1
@@ -2109,7 +2109,7 @@ sub git_commitdiff {
2109 die_error(undef, "Unknown commit object");
2110 }
2111 if (!defined $hash_parent) {
2112 - $hash_parent = $co{'parent'};
2112 + $hash_parent = $co{'parent'} || '--root';
2113 }
2114 open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
2115 or die_error(undef, "Open git-diff-tree failed");